How to access data variable passed in CTabView


i am passing custom variable to each tab in CTabView but didn’t get how to access that variable in the view

 $Tabs     = array









   $this->widget('CTabView', array('tabs'=>$Tabs));

How can i access position variable in my view

Your CTabView uses the same view ‘pages.php’ for each tab. You should instead have a separate view file for each page, eg. page1.php, page2.php, page3.php

The ‘data’ attribute ‘position’ can be accessed in your view file using PHP:


    echo $position;


i tried echoing $position but i got

Undefined variable : position

when i used different views for each it works but i found in the CTabView Google doc that data variable is only added for the same reason mean to pass a variable with different values to the same view

I just tested as per the code you posted. It will actually work with a single page ‘pages.php’ with:

<?php echo $position; ?>