Tue 30 Jan 2007
I’ve posted the code for an Ajax chat plugin for CakePHP at the SiteAMonth Sandbox. It’s really pretty basic, but works well enough and can be styled using CSS.
A couple of thoughts for improving it:
1) Some sort of spam protection.
2) When the user posts a message there is a moment before it shows up in the chat window that may be confusing.
3) New messages show up at the top. I think users are more accustomed to seeing new chat messages at the bottom. It is easy to switch, but javascript will have to be used to auto-scroll to the bottom.
If you have any questions, comments or bugs please leave a comment.
Popularity: 15% [?]










Follow!
February 18th, 2007 at 1:51 pm
1) you could add a random simple math problem (like 12+1) for the user to answer on first post and then store in the session that it’s a valid user.
It’s works nicely for other projects as effective anti-spam.
February 21st, 2007 at 10:26 pm
I have an intense dislike of captchas, but I’ve been seeing more and more of these math type problems used for verification. I have to say I’m a fan. Definitely a viable solution for limiting spam.
March 5th, 2007 at 5:24 pm
Pretty cool so far, but also very basic. This is more like a live-shoutbox. If you wanna dive into the topic you should work on things like cross-browser autoscrolling without iframes, session-based chatroom userlists and client/server BBCode support. Try to emulate IRC like commands, allow “whispering” etc. If you tackle any of this you are up to a real nice chat here.
Best, m3nt0r
March 5th, 2007 at 5:31 pm
btw.. for your show-up-late you can fake this by copying the value of the message input to the chatwindow and then overwrite the chatwindow with the data from the server. a user wont note the difference between what was created clientside and what was delivered by the server.
Check out the new Template Class in prototype. It’s great for things like this.
June 19th, 2007 at 4:40 am
I have tried this. The form has been shown, but when i click the ’send’ button, it seemed not work. I couldn’t figure out why..
June 19th, 2007 at 8:07 pm
bahari,
Did you include the Prototype Javascript library? You may want to install a tool like Firebug for Firefox to help debug the problem.
August 31st, 2007 at 3:32 am
Chat for cakePHP 1.2 doesn’t work can you please fix it?
January 20th, 2008 at 9:53 pm
aing teu ngarti
March 28th, 2008 at 8:57 pm
http://sandbox2.pseudocoder.com/demo/chat links to the v1.1 edition. Those trying to d/l it’s at: http://sandbox2.pseudocoder.com/files/CakePHP-Ajax-Chat-v1.2.zip
April 24th, 2008 at 1:33 am
It’s a really neat chat you have created!
I’m trying to use it for a project of mine, but the chat generation fails. The name and message input boxes shows up, but the chat get stuck at “Loading..”. Any ideas?
Thanks in advance.
April 24th, 2008 at 1:48 am
Solved! Renamed the prototype file to prototype.js.