Home  >  Article  >  Backend Development  >  PHP development framework Yii Framework tutorial (37) Zii component-Dialog example

PHP development framework Yii Framework tutorial (37) Zii component-Dialog example

黄舟
黄舟Original
2017-01-22 10:00:401463browse

CJuiDialog is used to display dialog boxes, modal or non-modal dialog boxes. It encapsulates the JUI Dialog plug-in.

The basic usage is as follows

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'mydialog',
'options'=>array(
'title'=>'Dialog',
'width'=>500,
'height'=>300,
'autoOpen'=>false,
),
));
echo 'dialog content here';
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
array('onclick'=>'$("#mydialog").dialog("open"); return false;')); ?>
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'mymodal',
'options'=>array(
'title'=>'Modal Dialog',
'width'=>400,
'height'=>200,
'autoOpen'=>false,
'resizable'=>false,
'modal'=>true,
'overlay'=>array(
'backgroundColor'=>'#000',
'opacity'=>'0.5'),
'buttons'=>array(
'OK'=>'js:function(){alert("OK");
}',
'Cancel'=>'js:function(){
$(this).dialog("close");}',
),
),
));
echo 'Modal dialog content here ';
$this->endWidget('zii.widgets.jui.CJuiDialog');?>
array('onclick'=>'$("#mymodal").dialog("open"); 
return false;')); 
?>

Mode and non-mode are configured by setting 'modal' =>true/false. CJuiDialog is used to define the dialog box. To display the dialog box, you still need to pass For other UI components, this example uses Link to display the dialog box.

PHP development framework Yii Framework tutorial (37) Zii component-Dialog example

The above is the content of the PHP development framework Yii Framework tutorial (37) Zii component-Dialog example. For more related content, please pay attention to the PHP Chinese website (www.php.cn) !

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn