Class CTabView
CTabView displays contents in multiple tabs.
At any time, only one tab is visible. Users can click on the tab header to switch to see another tab of content.
JavaScript is used to control the tab switching. If JavaScript is disabled, CTabView still manages to display the content in a semantically appropriate way.
To specify contents and their tab structure, configure theCTabView::$tabs
property. The CTabView::$tabs
property takes an array with tab ID being mapped tab
definition. Each tab definition is an array of the following structure:
- title: the tab title.
- content: the content to be displayed in the tab.
- view: the name of the view to be displayed in this tab. The view will be
rendered using the current controller's
CController::renderPartial()
method. When both 'content' and 'view' are specified, 'content' will take precedence. - url: a URL that the user browser will be redirected to when clicking on this tab.
- data: array (name=>value), this will be passed to the view when 'view' is specified.
For example, the CTabView::$tabs
property can be configured as follows,
$this->widget('CTabView', array( 'tabs'=>array( 'tab1'=>array( 'title'=>'tab 1 title', 'view'=>'view1', 'data'=>array('model'=>$model), ), 'tab2'=>array( 'title'=>'tab 2 title', 'url'=>'http://www.yiiframework.com/', ), ), ));
By default, the first tab will be activated. To activate a different tab when
the page is initially loaded, set CTabView::$activeTab
to be the ID of the desired
tab.
- CComponent
- CBaseController
- CWidget
- CTabView
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/widgets/CTabView.php
public
|
|
public
|
|
public static
|
|
protected
|
|
protected
|
__construct(),
actions(),
getController(),
getId(),
getOwner(),
getViewFile(),
getViewPath(),
init(),
render(),
setId()
|
beginCache(),
beginClip(),
beginContent(),
beginWidget(),
createWidget(),
endCache(),
endClip(),
endContent(),
endWidget(),
renderFile(),
renderInternal(),
widget()
|
string |
CSS_CLASS
|
'yiiTab' |
#
Default CSS class for the tab container |
public
mixed
|
$cssFile |
|
#
the CSS file used for the widget. Defaults to null, meaning using the default CSS file included together with the widget. If false, no CSS file will be used. Otherwise, the specified CSS file will be included when using this widget. |
public
string
|
$activeTab |
|
#
the ID of the tab that should be activated when the page is initially loaded. If not set, the first tab will be activated. |
public
array
|
$viewData |
|
#
the data that will be passed to the partial view rendered by each tab. |
public
array
|
$htmlOptions |
|
#
additional HTML options to be rendered in the container tag. |
public
array
|
$tabs | array() |
#
tab definitions. The array keys are the IDs, and the array values are the
corresponding tab contents. Each array value must be an array with the following
elements:
array( 'tab1'=>array( 'title'=>'tab 1 title', 'view'=>'view1', ), 'tab2'=>array( 'title'=>'tab 2 title', 'url'=>'http://www.yiiframework.com/', ), ) |
$actionPrefix,
$skin
|
$controller,
$id,
$owner,
$viewPath
|