PHP development framework YiiFramework tutorial (41) Zii component-Tabs example

Source: Internet
Author: User
PHP development framework YiiFramework tutorial (41) Zii component-Tabs example

The display page UI component of CJuiTabs is similar to the TabView sample function of the UI component of Yii Framework Development Tutorial (17). It encapsulates the JUI tabs plug-in.

The basic usage is as follows:

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,
),
'Htmlopexception' => array (
'Style' => 'width: 500px ;'
),
);?>

Three different content display methods are displayed. the Static Tab displays a Static content. the Render Tab uses Partial to Render a page, while the Ajax Tab displays a page through AJAX, note that the following two Actions must be defined in SiteController:

Public function

Actions ()
{
Return array (
'Page' => array (
'Class' => 'cviewaction ',
),
// AjaxContent action renders
// "Static" pages stored under 'protected/views/site/page'
// They can be accessed:
// Index. php? R = site/ajaxContent & view = FileName
'Ajaxcontent' => array (
'Class' => 'application. controllers. ajaxviewaction ',
),
);
} Among them, AjaxViewAction is a custom ViewAction, which is a subclass of CViewAction and can display static pages. its definition is as follows:

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 (400, 'invalidrequest.
Please do not repeat this request again .');
}
}

The result is as follows:


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.