PHP development framework YiiFramework tutorial (12) UI component ClipWidget example

Source: Internet
Author: User
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 )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.