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

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

黄舟
Release: 2023-03-05 09:24:02
Original
1390 people have browsed it

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'),
)); ?>
Copy after login

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',
),
),
),
Copy after login
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 (m.sbmmt.com)!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template