Skip to content

Commit a64ee14

Browse files
committed
Update for jQuery version.
1 parent 44eed21 commit a64ee14

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

README

+48-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
1-
// -----------------------------------------------------------------------------------
2-
//
3-
// CakePHP Ajax Chat v1.2
4-
// by Matt Curry - http://www.siteamonth.com
5-
// 2007-03-20
6-
//
7-
// For more information on this plugin, visit:
8-
// http://www.siteamonth.com/archives/2007/01/30/cakephp-ajax-chat/
9-
//
10-
// Licensed under the MIT License - http://www.opensource.org/licenses/mit-license.php
11-
//
12-
// Copyright (c) 2007 SiteAMonth.com
13-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
14-
// software and associated documentation files (the "Software"), to deal in the Software
15-
// without restriction, including without limitation the rights to use, copy, modify, merge,
16-
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit
17-
// persons to whom the Software is furnished to do so, subject to the following conditions:
18-
19-
// The above copyright notice and this permission notice shall be included in all copies
20-
// or substantial portions of the Software.
21-
22-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23-
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
24-
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
25-
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27-
// DEALINGS IN THE SOFTWARE.
28-
//
29-
//
30-
// -----------------------------------------------------------------------------------
31-
32-
Version 1.2
33-
- Fixed compatibility with CakePHP 1.2.
34-
35-
Version 1.1
36-
- Add the message to the chat window immediately using javascript.
1+
/*
2+
* CakePHP Ajax Chat Plugin (using jQuery);
3+
* Copyright (c) 2008 Matt Curry
4+
* www.PseudoCoder.com
5+
* http://github.com/mcurry/cakephp/tree/master/plugins/chat
6+
* http://sandbox2.pseudocoder.com/demo/chat
7+
*
8+
* @author Matt Curry <[email protected]>
9+
* @license MIT
10+
*
11+
*/
12+
13+
/* Description */
14+
A basic Ajax chat plugin for CakePHP using jQuery
15+
16+
/* Instructions */
17+
1. You'll need a working version of CakePHP installed. This is running on 1.2.0.7692 RC3.
18+
2. Download jQuery and put it in /app/webroot/js/
19+
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
20+
4. Run this sql to create the chats table.
21+
CREATE TABLE `chats` (
22+
`id` int(10) unsigned NOT NULL auto_increment,
23+
`key` varchar(45) NOT NULL default '',
24+
`name` varchar(20) NOT NULL default '',
25+
`message` text NOT NULL,
26+
`ip_address` varchar(15) NOT NULL default '',
27+
`created` datetime default NULL,
28+
PRIMARY KEY (`id`),
29+
KEY `KEY_IDX` (`key`)
30+
);
31+
32+
5. Include the plugin helper in your controller:
33+
var $helpers = array('chat.ajaxChat');
34+
35+
Or just in a particular action:
36+
$this->helpers[] = 'chat.ajaxChat';
37+
38+
6. Include jQuery in your view if you don't already include it in your layout.
39+
echo $javascript->link('jquery', false);
40+
41+
7. Include the chat js and css in your view.
42+
$javascript->link(array('jquery/jquery', '/chat/js/chat.js'), false);
43+
$html->css('/chat/css/chat.css', null, null, false);
44+
45+
46+
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.
47+
echo $ajaxChat->generate('chat1');
48+

0 commit comments

Comments
 (0)