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