Wednesday, January 15, 2014

CTabcontrol with each tab containing a widget (Yii)

Suppose in Yii, we want to pass the content of a widget to a tab in the tab control

<?php
ob_start();
$this->widget('zii.widgets.CListView', array(
    'dataProvider'=>$vulnerdataProvider,
    'itemView'=>'_latest_vulner'
));
$tab1Content=ob_get_contents();
ob_end_clean();

$this->widget('zii.widgets.jui.CJuiTabs',array(
    'tabs'=>array(
        'Tab1'=> array('content' => $tab1Content,'id' => 'tab1'),
        'tab2'=>array('content'=>'Content for tab 2', 'id'=>'tab2'),
    ),
    // additional javascript options for the tabs plugin
    'options'=>array(
        'collapsible'=>true,
    ),
));
?>

No comments:

Post a Comment