Yii Framework Development Tutorial Zii Component-tabs Sample _php Tutorial

Source: Internet
Author: User
The previous basic usage is as follows: [PHP] Widget (' Zii.widgets.jui.CJuiTabs ', Array (' Tabs ' =>array (' static tab ' = ' static content ', ' Render tab ' =>$ This->renderpartial (' Pages/_content1 ', null,true), ' Ajax tab ' =>array (' Ajax ' =>array (' ajaxcontent ', ' view ' = > ' _content2 '),), ' Options ' =>array (' collapsible ' =>true, ' selected ' =>1,), ' Htmloptions ' =>array (' Style ' = ' width:500px; '),?>); Widget (' Zii.widgets.jui.CJuiTabs ', Array (' Tabs ' =>array (' static tab ' = ' static content ', ' Render tab ' =>$ This->renderpartial (' Pages/_content1 ', null,true), ' Ajax tab ' =>array (' Ajax ' =>array (' ajaxcontent ', ' view ' = > ' _content2 '),), ' Options ' =>array (' collapsible ' =>true, ' selected ' =>1,), ' Htmloptions ' =>array (' Style ' = ' width:500px; '),);?> shows three different ways to display the content of a page, static tab displays a content, and render tab renders a page using partial, and Ajax tab displays a page through AJAX, noting that the following two actions need to be defined in Sitecontroller: [PHP] public Function actions () {return Array (' page ' =>array (' class ' = ' cviewaction ',),//Ajaxcontent action renders//"static" pages stored under ' protected/views/site/pages '/ /They can be accessed via://index.php?r=site/ajaxcontent&view=filename ' ajaxcontent ' =>array (' class ' = ') ' Application.controllers.AjaxViewAction ',),); The Public Function actions () {return Array (' page ' =>array (' class ' = ' cviewaction '),//Ajaxcontent action renders// "Static" pages stored under ' Protected/views/sitE/pages '//They can be accessed via://index.php?r=site/ajaxcontent&view=filename ' ajaxcontent ' =>array (' class ' = ' application.controllers.AjaxViewAction ',),);} Where Ajaxviewaction is a custom viewaction, a subclass of Cviewaction, a static page can be displayed, defined as follows: [PHP] class Ajaxviewaction extends Cviewaction { Private $_viewpath; Public Function Run () {if (Yii::app ()->request->isajaxrequest) {$this->resolveview ($this Getrequestedview ()); $controller = $this->getcontroller (); $controller->renderpartial ($this->view, NULL, FALSE, True); } else throw new Chttpexception (the ' Invalid request. Repeat this request again. '); }} class Ajaxviewaction extends cviewaction{private $_viewpath; public function run () {if (Yii::app ()->request-> Isajaxrequest) {$this->resolveview ($this->getrequestedview ()); $controller = $this->getcontroller (); $ Controller->renderpartial ($this->view, NULL, FALSE, True);} Elsethrow new chttpexception, ' Invalid request. Repeat this requestAgain. ');}} The results appear as follows:

http://www.bkjia.com/PHPjc/477828.html www.bkjia.com true http://www.bkjia.com/PHPjc/477828.html techarticle the former basic usage is as follows: [PHP]? php $this-widget (zii.widgets.jui.CJuiTabs, Array (tabs=array (Static tab=static content, Render tab= $this-renderpartial (pages/_content1,null,true), A ...

  • 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.