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

PHP development framework Yii Framework tutorial (35) Zii component-Button example

黄舟
黄舟Original
2017-01-22 09:54:291309browse

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:

PHP development framework Yii Framework tutorial (35) Zii component-Button example

##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:

PHP development framework Yii Framework tutorial (35) Zii component-Button example

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)!

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