The CClipWidget provides a function similar to the recording "macro". the content defined between the init and run of the CClipWidget can be stored in the Clip variable of the Controller, and then played back to any other location. The CClipWidget provides a function similar to the recording "macro". the content defined between the init and run of the CClipWidget can be stored in the Clip variable of the Controller, and then played back to any other location.
CClipWidget encapsulates the beginClip and endClip of CBaseController. The basic usage of beginClip and endClip of CBaseController is as follows:
First define Clip
$this->beginClip('clipID');// ... display the clip contents$this->endClip();
And then use the Clip.
echo $this->clips['clipID'];
If $ this points to a Widget instead of a Controller, you can use
echo $this->getController()->clips ['clipID'];
The method for using ClipWidget is as follows,
beginWidget('CClipWidget',array('id'=>'record')); ?>endWidget(); ?>clips['record']; ?>-----------clips['record']; ?>
Clip is defined first, which is defined by beginWidget and endWidget. The clip ID is passed in by the parameter id. Then you can call echo $ this-> clips ['record '] to display the recorded content as needed. The content between beginWidget and endWidget can be customized as needed. In this example, three lines of text are displayed.
The result is as follows:
The above is the content of the ClipWidget sample of the UI component of the PHP development Framework Yii Framework tutorial (12). For more information, see The PHP Chinese website (www.php1.cn )!