PHP Development Framework Yii Framework Tutorial (a) UI component Clipwidget sample

Source: Internet
Author: User

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

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.