Page 1 of 2

Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 11:52 am
by mvandek2
I have a menu with two levels.
The menu items with sublevels (parents) do not contain any content themselves.
I am trying to accomplish that clicking a parent only expands the menu to show the sublevel items. This should not open a page.

Is there menu that is able to do this in CMSMS?

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 12:21 pm
by uniqu3
You should use the first level as "Section Header"
About styling and functions, are you already using any menu template?

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 12:31 pm
by mvandek2
Thanks for your reply!

That's what I thought but that makes the parent do nothing anymore.
Perhaps my menu has a problem.

That brings me to another question, appareantly it is possible to importe menu templates and apply them but where can I get menu's?

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 12:41 pm
by uniqu3
The function depends on your styling.
It depends what menu template you are using and if the styling is applied in your stylesheet.

Now the question is how good is your xhtml, css and smarty knowledge.
In the default installation you have few MenuManager templates and styling available, all you need to do is look for the part where it says type == 'sectionheader' check what is applied there like or something and adjust it in the CSS.
That brings me to another question, appareantly it is possible to importe menu templates and apply them but where can I get menu's?
In the MenuManager you can see few Templates already listed like cssmenu.tpl if you click on "import to database" you can import it, name it and edit directly in MenuManager.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 1:02 pm
by mvandek2
None of the menu templates behave like they should with a menu parent configured as "section header". Can you confirm that "cssmnu" supports this?

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 1:25 pm
by uniqu3
No i can't confirm, personally i never use default menus and styling so i can't tell you if any of these works out of the box and what stylesheet you will have to apply to your template.

You could take a look in the WIKI
http://wiki.cmsmadesimple.org/index.php ... nu_Manager

maybe there is something what you can start with or do you have a live example where we can see how your current markup looks like and what can be done.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 4:44 pm
by mvandek2
I applied the "section_expand" menu on http://test.euro-pa.com.
You can access the control panel with test/test.

You see that the menu opens and closes inconsistently.
If would appreciate it very much if you can take a look.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 5:21 pm
by uniqu3
how do you call your menu in the template?

It should work like this {menu template='yourmenuname' collapse='0'}
collapse='0' would solve your problem of menu collapsing when you go to subpage.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 5:38 pm
by mvandek2
I use {menu template='section_expand' collapse='0'} in the templates.
Still it behaves weird, opening 2 menu's when you open a menu.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 5:40 pm
by uniqu3
yes i noticed my theory was wrong :) i'll test the menu on my demo installation.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 6:58 pm
by uniqu3
Ok i didn't get it to work as it should, same problem as on your site so another solution.

Download treeview plugin:
http://www.dynamicdrive.com/dynamicinde ... eeview.zip

Menu template:

Code: Select all

{if $count > 0}
<ul id="navigation">
{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->parent == true or ($node->current == true and $node->haschildren == true)}
<li><a class="current" {elseif $node->current == true}
<li><a class="current" {elseif $node->haschildren == true}
<li><span {elseif $node->type == 'sectionheader'}
<li>{$node->menutext} {elseif $node->type == 'separator'}
<li>{else}
<li><a {/if} {if $node->type != 'sectionheader' and $node->type != 'separator'}href="{$node->url}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{else}title="{$node->menutext}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</span>{/if}{/foreach}{repeat string="</li></ul>" times=$node->depth-1}</li></ul>
{/if}
In your Template:
Add jquery and treeview plugin

Code: Select all

<__script__ type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></__script> 
<__script__ type="text/javascript" src="uploads/scripts/jquery.treeview.min.js"></__script>
{literal}
<__script__ type="text/javascript">
$(document).ready(function(){
	$("#navigation").treeview({
		collapsed: true,
		unique: true,
		persist: "location"
	});
});
</__script>
{/literal}
The menu i named the template treemenu

Code: Select all

{menu template='treemenu'}
See demo: http://demo.i-arts.eu/home

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 7:16 pm
by mvandek2
Thanks for the effort in advance!

I don't understand the demo, you mean the menu top right but it does not expand/collapse.
Am I missing something?

Thanks again.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Thu Jul 01, 2010 7:19 pm
by uniqu3
yes top right and oh forgot to mention, "test" is collapsible.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Sat Jul 03, 2010 10:05 am
by mvandek2
I guess I add the content of "jquery.treeview.zip" to my CMSMS directory?
What stylefile to use?

Thanks again.

Re: Menu: clicking parent should only expand menu, not open page

Posted: Sat Jul 03, 2010 10:24 am
by uniqu3
i usually add all my js files in the theme folder.
Mostly on my websites it look like this /uploads/Themename/js/somejsfile.js but you can also put it somewhere else as long you call in the template right.

For example on my demo page:

Code: Select all

<__script__ type="text/javascript" src="uploads/scripts/jquery.treeview.min.js"></__script> 
I didn't use any stylesheet included in the pack, you can style it as you want, so if you already styled you navigation like {menu template='treemenu'} you are good to go.

As long as you adjust the path to the script you should be good to go by copy/pasting my examples above.