Yii 1.1: state-jui-accordion

Custom CJuiAccordion extension to enable it to remember state (navigation=true)

I was having problems in creating an accordion menu which remembered state. Setting navigation to true in options didn't help.

After some time of debugging, I realised that the default CJuiAccordion class outputs the head sections as links with href as #, which causes navigation not to work. Even if you were to put "<a href='?r=blah'>A Header</a>" as the key, it wouldn't work either as it will create ANOTHER href with #.

So I wrote a quickie custom class to enable accordion menus which remember state.



  • Yii 1.1 or above


  • Extract the release file under protected/components


See the following code example:

For example: '?r=site' will be used as the anchor link for the Home panel.

$this->widget('StateCJuiAccordion', array(
            "Home"=>array('href'=>'?r=site', 'content'=>$home_menu),
            "Panel 2"=>array('href'=>'?r=p2', 'content'=>$p2_menu),

Change Log

March 23, 2010

  • Initial release.

Total 2 comments

#7573 report it
Lê Văn Chiến at 2012/03/31 12:09am
question two ?

Yii::import('zii.widgets.jui.CJuiAccordion'); does not exist ?

#5172 report it
ToolMayNARD at 2011/09/21 03:49am

What is the purpose of this extension? Whatever link I put in href, the accordion does not open any page but opens only the relative panel. Maybe I have misunderstood the accordion's purpose with regards to navigation option?

Leave a comment

Please to leave your comment.

Create extension