Skip to content

Commit

Permalink
Update for jQuery version.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcurry committed Oct 23, 2008
1 parent 44eed21 commit a64ee14
Showing 1 changed file with 48 additions and 36 deletions.
84 changes: 48 additions & 36 deletions README
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
// -----------------------------------------------------------------------------------
//
// CakePHP Ajax Chat v1.2
// by Matt Curry - http://www.siteamonth.com
// 2007-03-20
//
// For more information on this plugin, visit:
// http://www.siteamonth.com/archives/2007/01/30/cakephp-ajax-chat/
//
// Licensed under the MIT License - http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) 2007 SiteAMonth.com
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
//
// -----------------------------------------------------------------------------------

Version 1.2
- Fixed compatibility with CakePHP 1.2.

Version 1.1
- Add the message to the chat window immediately using javascript.
/*
* CakePHP Ajax Chat Plugin (using jQuery);
* Copyright (c) 2008 Matt Curry
* www.PseudoCoder.com
* http://github.com/mcurry/cakephp/tree/master/plugins/chat
* http://sandbox2.pseudocoder.com/demo/chat
*
* @author Matt Curry <matt@pseudocoder.com>
* @license MIT
*
*/

/* Description */
A basic Ajax chat plugin for CakePHP using jQuery

/* Instructions */
1. You'll need a working version of CakePHP installed. This is running on 1.2.0.7692 RC3.
2. Download jQuery and put it in /app/webroot/js/
3. Put chat plugin into app/plugins/chat. The plugin is called "chat", so make sure there is no conflict with any other controllers or plugins
4. 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 '',
`name` varchar(20) NOT NULL default '',
`message` text NOT NULL,
`ip_address` varchar(15) NOT NULL default '',
`created` datetime default NULL,
PRIMARY KEY (`id`),
KEY `KEY_IDX` (`key`)
);

5. Include the plugin helper in your controller:
var $helpers = array('chat.ajaxChat');

Or just in a particular action:
$this->helpers[] = 'chat.ajaxChat';

6. Include jQuery in your view if you don't already include it in your layout.
echo $javascript->link('jquery', false);

7. Include the chat js and css in your view.
$javascript->link(array('jquery/jquery', '/chat/js/chat.js'), false);
$html->css('/chat/css/chat.css', null, null, false);


8. 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');

0 comments on commit a64ee14

Please sign in to comment.