Home >Backend Development >PHP Tutorial >PHP development framework Yii Framework tutorial (35) Zii component-Button example
CJuiButton displays a button. CJuiButton can be used as a Submit button or an ordinary button.
The basic usage of buttons is as follows:
widget('zii.widgets.jui.CJuiButton', array( 'buttonType'=>'submit', 'name'=>'btnSubmit', 'value'=>'1', 'caption'=>'Submit', 'htmlOptions'=>array('class'=>'ui-button-primary') )); ?> widget('zii.widgets.jui.CJuiButton', array( 'buttonType'=>'button', 'name'=>'btnClick', 'caption'=>'Click', //'options'=>array('icons'=>'js:{primary:"ui-icon-newwin"}'), 'onclick'=>'js:function(){alert("clicked"); this.blur(); return false;}', )); ?> widget('zii.widgets.jui.CJuiButton', array( 'buttonType'=>'link', 'name'=>'btnGo', 'caption'=>'Go', //'options'=>array('icons'=>'js:{secondary:"ui-icon-extlink"}'), 'url'=>array('site/other'), )); ?>
Of these three buttons, the first is used as a Submit button, the second is used as a normal button, triggering JavaScripts events, and the third triggers the otherAction method after being clicked. .
The display result is as follows:
##You can add CSS files for Jui UI components, which can be set through the configuration file:'components'=>array( 'clientScript' => array( 'scriptMap' => array( 'jquery-ui.css'=> dirname($_SERVER['SCRIPT_NAME']) .'/css/jui/custom/jquery-ui.css', ), ), ),Here we copy the JQuery CSS file used by YiiPlayground. After using the new CSS style, it is displayed as follows: The above is the PHP development framework Yii Framework tutorial (35) Zii component-Button example For more related content, please pay attention to the PHP Chinese website (www.php.cn)!