Cjuitabs

[size="4"]Format 1:Basic[/size]


$this->widget('zii.widgets.jui.CJuiTabs', array(

    'tabs' => array(

        'StaticTab 1' => 'Content for tab 1',

        'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),

        // panel 3 contains the content rendered by a partial view

        'AjaxTab' => array('ajax' => $this->createUrl('...')),

    ),


    // additional javascript options for the tabs plugin

    'options' => array(

        'collapsible' => true,

    ),

));

[size="4"]Format 2:Content Using Render Method[/size]




$this->widget('zii.widgets.jui.CJuiTabs', array(

    'tabs' => array(

        'StaticTab 1' => 'Content for tab 1',

        'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),

        // panel 3 contains the content rendered by a partial view

        'AjaxTab' => array('ajax' => $this->createUrl('..')),

[color="#FF0000"]// Get Content From Another page. Also Pass Parameter[/color]

        'Render View'=>$this->renderPartial('_newpage',

                                array('value'=>$value),

                                              TRUE

       )),

    ),


    // additional javascript options for the tabs plugin

    'options' => array(

        'collapsible' => true,

    ),

    // set id for this widgets

    'id'=>'MyTab',

));



[size="4"]Format 3:Content Using Render Method And Set Id For Each Single Tab[/size]


$this->widget('zii.widgets.jui.CJuiTabs', array(

    'tabs' => array(

        'StaticTab 1' => 'Content for tab 1',

        'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),

        // panel 3 contains the content rendered by a partial view

        'AjaxTab' => array('ajax' => $this->createUrl('..')),

        'Render View'=>array('id'=>'renderid',

                             'content'=>$this->renderPartial(

                                '_newpage',

                                 array('value'=>$value),TRUE)

                              ),

    ),


    // additional javascript options for the tabs plugin

    'options' => array(

        'collapsible' => true,

    ),

    // set id for this widgets

    'id'=>'MyTab',

));

[size="4"]Dynamic CJuiTabs[/size]


$tab_list=Componenttabs::gettabs();

$tabarray=array();

$i=1;

foreach ($tab_list as $key=>$value){  

 $tabarray["Tab $i"]=array('id'=>$i,

                            'content'=>$this->renderPartial(

                                       '_newpage',                                

                                        array('value'=>$value),

                                        TRUE)

     );

 $i++;

}


$this->widget('zii.widgets.jui.CJuiTabs', array(

    'tabs'=>

  $tabarray,

/*array(

        'StaticTab 1'=>'Content for tab 1',

        'StaticTab 2'=>array('content'=>'Content for tab 2', 'id'=>'tab2'),

        // panel 3 contains the content rendered by a partial view

        //'AjaxTab'=>array('ajax'=>$ajaxUrl),

    ),*/


    // additional javascript options for the tabs plugin

    'options'=>array(

        'collapsible'=>true,

    ),

    'id'=>'categorytabs',

));

[color="#FF0000"]Hint[/color]

When you use more than one CJuiTabs "Dont Forget" to set "ID".

Otherwise you will get some problem

[color="#006400"]/* Moved from "General Discussion for Yii 1.1.x" to "Tips, Snippets and Tutorials" */[/color]

Thanks mbala for your contribution.

Would you please re-edit the post using "code" tag ("<>" button) to make it more useful?

Thanks