PHP Development Framework Yii Framework Tutorial (a) Zii component-tabs sample

Source: Internet
Author: User
Tags yii

The cjuitabs displays the paging UI component, similar to the Yii Framework Development Tutorial (Tabview) UI component, which encapsulates the JUI tabs plug-in.

The former basic usage is as follows:

<?php $this->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; ' 
    ),     
));?>

Displays three different content display methods, static tab to display a passive content, Render tab uses partial to render a page, while Ajax tab displays a page via Ajax, Note the following two needs are defined in Sitecontroller as follows:

Public function 

actions ()     
{return
    array ('
        page ' =>array ('
                class ' => ' Cviewaction '
                ) ,
        //ajaxcontent action renders
        //"Static" pages stored under ' protected/views/site/pages '
        //They can be ACC Essed via:
        //index.php?r=site/ajaxcontent&view=filename
        ' ajaxcontent ' =>array (
                ' class ' = > ' application.controllers.AjaxViewAction ',)
            ,
        );     
}

Where Ajaxviewaction is a custom viewaction, a subclass of cviewaction that can display a static page, which is defined 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, ' Invalid request.
               Please don't repeat this request again. '}
}

The results appear as follows:

See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm

This example downloads: Http://www.imobilebbs.com/download/yii/JuiProgressBarDemo.zip

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.