Cclipwidget provides the ability to record "macros", and the content defined between Init and run of Cclipwidget can be stored in the controller's clip variable and replayed back to any other location.
Cclipwidget encapsulates the basic usage of beginclip and endclip for Cbasecontroller Beginclip and Endclip,cbasecontroller as follows:
First define Clip
$this->beginclip (' clipid ');//... display the clip contents$this->endclip ();
And then we need to use this clip.
echo $this->clips[' clipid '];
If $this points to not a controller, but a widget, you can use the
echo $this->getcontroller ()->clips [' Clipid '];
Here's how to use Clipwidget,
Beginwidget (' Cclipwidget ', array (' id ' = ' record '));? >endwidget (); >clips[' record '];?>----------- clips[' record ';?>
The first is also the definition of clip, which is defined by Beginwidget and Endwidget, and the clip ID is passed in by the parameter ID. Then you can call echo $this->clips[' record ']; Show the recorded content where it is needed. The content between Beginwidget and Endwidget can be customized as needed, and this example displays three lines of text.
The results appear as follows:
The above is the content of the PHP Framework Yii Framework Tutorial (Clipwidget) UI component sample, more about topic.alibabacloud.com (www.php.cn)!