Wanted: Simple vertical menu that can collapse children of selected parent

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
jomoweb
Forum Members
Forum Members
Posts: 49
Joined: Wed Jan 31, 2007 9:27 pm

Wanted: Simple vertical menu that can collapse children of selected parent

Post by jomoweb »

Hi,

I can not find a patch anywhere to perform this.  It should be fairly simple, but not so much for someone who lacks in the programming dept...  I am using simple_navigation.tpl, but am open to any new ideas...

Currently the menu looks like this:

* Parent 1
* Parent 2
* Parent 3


You click on Parent 2, and it looks like this:

* Parent 1
* Parent 2
    * Child 1
    * Child 2
    * Child 3
* Parent 3


Now, if you click on parent 1 or 3, parent 2 collapses (and the others expand).  My hope is to find a way to collapse the hild elements of parent 2 when clicked on.

Thanks!  Any help is greatly appreciated.
jomoweb
Forum Members
Forum Members
Posts: 49
Joined: Wed Jan 31, 2007 9:27 pm

Re: Wanted: Simple vertical menu that can collapse children of selected parent

Post by jomoweb »

Bump
jomoweb
Forum Members
Forum Members
Posts: 49
Joined: Wed Jan 31, 2007 9:27 pm

Re: Wanted: Simple vertical menu that can collapse children of selected parent

Post by jomoweb »

Ok, I am so close on this one and I promise to post the code if/when I finish it, because I am sure others will like this feature.  My last hurdle is to insert a dynamic id to the second "" that is repeated. 

I need to make it say this basically:
hierarchy}>

But when I try that I get this error:
Catchable fatal error: Object of class stdClass could not be converted to string

Does anyone know how I can parse that smarty tag and insert it, or avoid this error?

Full Menu Template so far:
{* CSS classes used in this template:
.activeparent - The top level parent when a child is the active/current page
li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable.
.clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation.
li.sectionheader h3 - To style section header
li.separator - To style the ruler for the separator *}

{if $count > 0}

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat  string="hierarchy}[/b]>" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}

{elseif $node->index > 0}
{/if}

{if $node->current == true}
hierarchy}">Current page is {$node->hierarchy}: hierarchy}');">{$node->menutext}

{elseif $node->parent == true}
url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>{$node->hierarchy}: {$node->menutext}

{else}
hierarchy}">url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}{if $node->target != ''} target="{$node->target}"{/if}>{$node->hierarchy}: {$node->menutext}
{/if}

{/foreach}
{repeat string="" times=$node->depth-1}

{/if}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Wanted: Simple vertical menu that can collapse children of selected parent

Post by Dr.CSS »

You may want to check this out, it's made to click on parents and collapse the children w/o changing pages or refresh...

http://wiki.cmsmadesimple.org/index.php ... con_expand
Post Reply

Return to “CMSMS Core”