Page 1 of 1

Implementing a Custom Accordion Menu Navigation

Posted: Wed Dec 05, 2007 7:06 pm
by mrian
Hello,

I am running the CMS Made Simple 1.2.2. I am trying to modify the menu template to integrate an accordion menu. I appreciate any help/guidance/tips as I am new to CMS Made Simple. 

The current .tpl template file is as follows:

Code: Select all

{* 
	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}
<ul>
	{foreach from=$nodelist item=node}
		{if $node->depth > $node->prevdepth}
			{repeat string="<ul>" times=$node->depth-$node->prevdepth}
		{elseif $node->depth < $node->prevdepth}
			{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
		</li>
		{elseif $node->index > 0}
		</li>
		{/if}
			
		{if $node->current == true}
			<li class="currentpage">{$node->menutext}
		{elseif $node->parent == true}
			<li class="activeparent"><a class="activeparent" href="{$node->url}"
			{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}
			{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}
			{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>
			{$node->menutext}</a>
		{elseif $node->type == 'sectionheader'}
			<li class="sectionheader">{$node->menutext}
		{elseif $node->type == 'separator'}
			<li class="separator" style="list-style-type: none;"> <hr />
		{else}
			<li><a href="{$node->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->menutext}</a>
		{/if}
	{/foreach}
	{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
The output of that .tpl template file is as follows:

Code: Select all

<div id="side_navigation">
  <ul>
    <!-- Parent -->
    <li class="currentpage">Parent 1
    <!-- Parent -->
    <li>      
      <a href="#">Parent 2</a>
      <!-- Start Children -->
      <ul>
        <li><a href="#">Child 1</a>
        <li><a href="#">Child 2</a>
        <li><a href="#">Child 3</a>
      </ul>
    <!-- End Children -->
    <!-- Parent -->
    <li><a href="#">Parent 3</a>
    <li>
      <!-- Start Parent -->
      <a href="#">Parent 4</a>
      <!-- Start Children -->
      <ul>
        <li><a href="#">Child 1</a>
        <li><a href="#">Child 2</a>
        <li><a href="#">Child 3</a>
      </ul>
      <!-- End Children -->
    </ul>
</div>
The desired output I am looking for is:

Code: Select all

<div class="toggle_controller"><h3>Parent 1</h3></div>
<div class="toggle_content">
  <ul>
    <li>Child node 1</li>
    <li>Chid node 2</li>
    <li>Child node 3</li>
  </ul>
</div>
<div class="toggle_controller"><h3>Parent 2</h3></div>
<div class="toggle_content">
  <ul>
    <li>Child node 1</li>
    <li>Chid node 2</li>
    <li>Child node 3</li>
  </ul>
</div>
Thank you very much for your help!

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed Dec 05, 2007 7:23 pm
by savacom
I'm looking for the same solution today, so please someone out there help, help, help!!!!!!!

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed Dec 05, 2007 8:25 pm
by cyberman
Have you make a look at MenuManagers help?

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed Dec 05, 2007 8:50 pm
by mrian
cyberman wrote: Have you make a look at MenuManagers help?
Thanks for the reply. Yes, I checked the documentation and it doesn't address my question — The documentation simply outlines the properties available to the module. What I am seeking assistance with, in particular, is how to structure the Smarty syntax according to what I would like to accomplish.

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed Dec 05, 2007 9:14 pm
by cyberman
Not sure what you mean with accordeon menu (I'm not a native english speaker) but think maybe parameter collapse can help ...

Re: Implementing a Custom Accordion Menu Navigation

Posted: Fri Dec 14, 2007 6:56 pm
by Dr.CSS
They want something where you click a title and child pages appear click next title and first collapses and next children appear...

Look in the hand book/wiki/documentation tab above under menu manager, there is one but I'm not sure it will collapse open items...

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed May 14, 2008 12:53 am
by Dr.CSS
OK I know this is an old post but here it goes, 2 collapse/accordion menus...

First one is not totaly driven by the menu manager template, it has 3 menu calls between the HTML tags that make it work...

http://multiintech.com/rounded/grey-slide.html&nbsp;   you click one of the first 3 gray areas, not the last one...

Second one is from dynamicdrive.com  and it is driven by the menu manager template, using section headers as clicking links and can have third level section headers that can click to open/expand more items and it remembers which one was open...

http://multiintech.com/squared/accordion-menu.html

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed Jul 23, 2008 5:55 pm
by Jevos
reviving an old post: the accordion solution is very nice... but: how do i implement this?

Jevos

Re: Implementing a Custom Accordion Menu Navigation

Posted: Wed Jul 23, 2008 11:17 pm
by Dr.CSS
It's driven by the script form dynamicdrive.com and a custom menu template I made and all the gray click collapsing parts are section headers...

Re: Implementing a Custom Accordion Menu Navigation

Posted: Mon Nov 02, 2009 3:24 pm
by point4design
Dr. CSS wrote: It's driven by the script form dynamicdrive.com and a custom menu template I made and all the gray click collapsing parts are section headers...
I know this is an old topic, but I'm looking to do a similar menu. Would you be willing to share your custom menu template?