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

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post 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?
uniqu3

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

Post by uniqu3 »

You should use the first level as "Section Header"
About styling and functions, are you already using any menu template?
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post 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?
uniqu3

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

Post 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.
Last edited by uniqu3 on Thu Jul 01, 2010 12:44 pm, edited 1 time in total.
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post 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?
uniqu3

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

Post 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.
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post 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.
uniqu3

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

Post 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.
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post 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.
uniqu3

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

Post by uniqu3 »

yes i noticed my theory was wrong :) i'll test the menu on my demo installation.
uniqu3

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

Post 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
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post 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.
uniqu3

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

Post by uniqu3 »

yes top right and oh forgot to mention, "test" is collapsible.
mvandek2
Forum Members
Forum Members
Posts: 39
Joined: Wed Apr 28, 2010 8:48 pm

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

Post by mvandek2 »

I guess I add the content of "jquery.treeview.zip" to my CMSMS directory?
What stylefile to use?

Thanks again.
uniqu3

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

Post 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.
Post Reply

Return to “Layout and Design (CSS & HTML)”