As the chief developer of MutableLabs, I found that when using the YiiBootstrap tab (Tabs) component, we sometimes need users to directly view the specified tab instead of the first one. YiiBootstrap has provided the & quot; active & quot; variable, which allows you to define which tab to display in PHP. I found that this method is also
As the chief developer of Mutable Labs, I found that when using the Yii Bootstrap tab (Tabs) component, we sometimes need users to directly view the specified tab instead of the first one. Yii Bootstrap has provided the "active" variable, through which you can define which tab to display in PHP. I found that this method is also very troublesome, because we need to insert PHP code or extend the tab component for each tab component to implement it in some way.
In any case, I found the best method for me-the JQuery solution, as shown below. Make sure that the ID of the tab area is "tabs". if there are multiple tab areas, use the same code for the tabs in other areas. You only need to put this code in the layout or header file...
《script》 $(document).ready(function() { $('#tabs a:contains("
")').tab('show'); });《script》
Then you only need to set the "tab" variable in the URL. The configured tab is displayed when the page is loaded. The following is an example of how to use it, provided that you have added the above code...
widget("bootstrap.widgets.TbTabs", array( "id" => "tabs", "type" => "tabs", "tabs" => array( array("label" => "Books", "content" => "Some content", "active" => true), array("label" => "Authors", "content" => "Some content"), ),)); ?>
The access URL is as follows...
Index. php? R = controller/action & tab = Authors
The "Authors" tab is used as the activity tab instead of "Books". if no tab is specified in the GET parameter, the default activity tab is used, as shown in the "Books" tab in the example.