Yii 1.1: state-jui-accordion

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

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.

Documentation

Requirements

  • Yii 1.1 or above

Installation

  • Extract the release file under protected/components

Usage

See the following code example:

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

[php]
$this->widget('StateCJuiAccordion', array(
        'panels'=>array(
            "Home"=>array('href'=>'?r=site', 'content'=>$home_menu),
            "Panel 2"=>array('href'=>'?r=p2', 'content'=>$p2_menu),
        ),
        'options'=>array(
            'navigation'=>true,
            'active'=>false,
        ),

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
Question

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