Yii CJuiDialog

CJuiDialog displays a dialog widget. This article will give the information about "how to handle cjuidialog" in yii framework. I added the sourcecode below.

Yii CJuiDialog : Default


<h1>Yii CJuiDialog : Default</h1>
<?php
/** Start Widget **/
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
    'id'=>'mydialog',
    'options'=>array(
        'title'=>'Dialog box',
        'autoOpen'=>false,
    ),
));

echo 'dialog content here';

$this->endWidget('zii.widgets.jui.CJuiDialog');
/** End Widget **/

echo CHtml::link('Open Dialog', '#', array(
    'onclick'=>'$("#mydialog").dialog("open"); return false;',
));

?>

Yii CJuiDialog : Animation


<h1>Yii CJuiDialog : Animation</h1>
<?php
/** Start Widget **/
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
    'id'=>'dialog-animation',
    'options'=>array(
        'title'=>'Dialog box - Animation',
        'autoOpen'=>false,
        'show'=>array(
            'effect'=>'blind',
            'duration'=>1000,
        ),
        'hide'=>array(
            'effect'=>'explode',
            'duration'=>500,
        ),            
    ),
));

echo 'Animation Dialog Content';
$this->endWidget('zii.widgets.jui.CJuiDialog');
/** End Widget **/
echo CHtml::button('Open Dialog', array(
    'onclick'=>'$("#dialog-animation").dialog("open"); return false;',
));
?>

Yii CJuiDialog : Auto Open


<h1>Yii CJuiDialog : Auto Open</h1>
<?php
$cjuidialog['heading']='CJuiDialog : Alert';
$cjuidialog['content']='CJuiDialog Auto Show';
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
    'options'=>array(
        'show' => 'blind',
        'hide' => 'explode',
        'modal' => 'true',
        'title' => $cjuidialog['title'],
        'autoOpen'=>true,
    ),
)); 

echo $cjuidialog['content']; 

$this->endWidget('zii.widgets.jui.CJuiDialog');
?>

  • Hi Mbala, how to make a dialog (‘AutoOpen’ => true,
    ) Appeared only 1 time?

    • mbala

      CJuidialog will open automatically When we set autoOpen “True”. It will happen on page load and only one time in page.