membuat applikasi chat dengan YII

download https://bitbucket.org/christiansalazarh/yiichat

ekstract di protected/extensions/

pada main.php setting

[php]

‘imports’=>array( ‘application.extensions.yiichat.*’, ),

[/php]

pada site controller

[php]

class SiteController extends Controller {

public function actions() {

return array(
‘captcha’=>array(
‘class’=>’CCaptchaAction’, ‘backColor’=>0xFFFFFF, ),
‘page’=>array( ‘class’=>’CViewAction’, ),</pre>
‘yiichat’=>array(‘class’=>’YiiChatAction’), //
}
[/php]

pasang widget pada index.php

[php]
<h1>Yii Chat Demo</h1>
<div id=’chat’></div>
<?php $this->widget(‘YiiChatWidget’,
array( ‘chat_id’=>’123’, // a chat identificator ‘identity’=>1,
// the user, Yii::app()->user->id ? ‘selector’=>’#chat’,
// were it will be inserted ‘minPostLen’=>2,
// min and ‘maxPostLen’=>10, <
// max string size for post ‘model’=>new MyYiiChatHandler(),
// the class handler. **** FOR DEMO, READ MORE LATER IN THIS DOC ****
‘data’=>’any data’, // data passed to the handler
// success and error handlers, both optionals.
‘onSuccess’=>new CJavaScriptExpression
( "function(code, text, post_id){ }"),
‘onError’=>new CJavaScriptExpression
( "function(errorcode, info){ }"), )); ?>

[/php]

voila, demo chatting sudah bisa di akses 🙂

Leave a Reply