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

PHP development framework Yii Framework tutorial (38) Zii component-ProgressBar example

黄舟
黄舟Original
2017-01-22 10:01:571598browse

CJuiProgressBar displays a progress bar. It encapsulates the JUI Progressbar plugin. CJuiProgressBar displays a progress bar. It encapsulates the JUI Progressbar plugin.

widget('zii.widgets.jui.CJuiProgressBar', array(
'id'=>'progress',
'value'=>0,
'htmlOptions'=>array(
'style'=>'width:200px; height:20px; float:left;'
),
));
?>

To demonstrate the progress bar, we use JavaScripts to change the current value of the progress bar and use a text to display the current value of the progress bar.

// Dummy function just to provide an example
Yii::app()->clientScript->registerScript('scriptId', "
var count = 0;
var step = 10;
var speed = 500;
function progress() {
$('#amount').text(count+'%');
$('#progress').progressbar('option', 'value', count);
if(count < 100) {
count = count+step;
setTimeout(progress, speed);
}
}
progress();
", CClientScript::POS_LOAD);
?>
...

PHP development framework Yii Framework tutorial (38) Zii component-ProgressBar example

The above is the content of the PHP development framework Yii Framework tutorial (38) Zii component-ProgressBar 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