membuat applikasi chat dengan YII


ekstract di protected/extensions/

pada main.php setting


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


pada site controller


class SiteController extends Controller {

public function actions() {

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

pasang widget pada index.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){ }"), )); ?>


voila, demo chatting sudah bisa di akses 🙂

Leave a Reply

© 2021 IT & Photography blog | WordPress Theme : ScrollMe