Ajax Chat Plugin
A basic Ajax chat plugin.
A .zip of the plugin is available at http://sandbox.siteamonth.com/demo/chat
1. Download Prototype (http://www.prototypejs.org/) and put it in /app/webroot/js/
2. Download and unzip the plugin to app/plugins. The plugin is called "chat", so make sure there is no conflict with any other controllers/plugins
3. Run this sql to create the chats table.
4. Include the helper in your controller
5. Include Prototype in your view if you don't already include it in your layout.
6. Then just add the chat to your view. You can have multiple chats on your site by changing the chat key - "chat1" in this example.
1. Download Prototype (http://www.prototypejs.org/) and put it in /app/webroot/js/
2. Download and unzip the plugin to app/plugins. The plugin is called "chat", so make sure there is no conflict with any other controllers/plugins
3. Run this sql to create the chats table.
CREATE TABLE `chats` (
`id` int(10) unsigned NOT NULL auto_increment,
`key` varchar(45) NOT NULL default '',
`handle` varchar(20) NOT NULL default '',
`text` text NOT NULL,
`ip_address` varchar(12) NOT NULL default '',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `KEY_IDX` (`key`)
);
4. Include the helper in your controller
var $helpers = array('Ajax', 'chat/AjaxChat');
5. Include Prototype in your view if you don't already include it in your layout.
echo $javascript->link('prototype');
6. Then just add the chat to your view. You can have multiple chats on your site by changing the chat key - "chat1" in this example.
echo $ajaxChat->generate('chat1');








Whenever chat loads, something must be going wrong w/ my user session, because I'm immediately logged out.
ideas?
Error: UpdateController could not be found.
can any one explain why this error occured?
i m using cakePHP 1.2.8284
I include the helper in the app_controller even:
class AppController extends Controller
{
var $helpers = array('Ajax', 'chat/AjaxChat');
}
?>
Also, does this work properly in Cake Version 1.2 or are modifications necessary?
var $helpers = array('Ajax', 'chat.AjaxChat');
I doubt this version will work in 1.2. The jQuery version should work though: http://bakery.cakephp.org/articles/view/ajax-chat-plugin-using-jquery
http://sandbox2.pseudocoder.com/files/CakePHP-Ajax-Chat-v1.1.zip
The link is dead??
Comments are closed for articles over a year old