Cclipwidget provides a feature like recording "Macros," where the content between Cclipwidget Init and run can be stored in a controller clip variable, and then replayed back to any other location.
The basic uses of the Cclipwidget package are Cbasecontroller Beginclip and Endclip,cbasecontroller Beginclip and Endclip are as follows:
First define Clip
$this->beginclip (' clipid ');
... display the clip contents
$this->endclip ();
And then we need to use this clip place.
echo $this->clips[' clipid '];
If $this is pointing not to controller, but to a widget, you can use the
echo $this->getcontroller ()->clips [' Clipid '];
The way to use Clipwidget is as follows,
<center class= "Form" >
<?php $form = $this->beginwidget (' Cclipwidget ',
array (' ID ' => ' record ') );?>
<?php Echo ' This is a ';?>
<br/> <?php
Echo ' This are second line ';? >
<br/>
<?php echo ' This are third line ';?> <?php
$this->endwidget ();?>
<?php Echo $this->clips[' record ']; ? >
<p>-----------</p>
<?php echo $this->clips[' record ']; ? >
</center><!--form-->
The first is the definition of clip, which is defined by Beginwidget and Endwidget, and the clip ID is passed in by the parameter ID. You can then invoke the Echo $this->clips[' record ']; Display the contents of this recording where needed. The content between Beginwidget and Endwidget can be customized as needed, and this example shows three lines of text.
The results appear as follows:
This example downloads: Http://www.imobilebbs.com/download/yii/ClipWidgetDemo.zip
See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm