Forums / Setup & design / Problem with menues

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Problem with menues

Author Message

Siw Helen Thorslund

Wednesday 10 November 2004 3:49:38 am

I have a problem with menues.

My site contains several folders that I want different menues for.

The node-tree looks something like this:

                       root
                        |
	           ------------
                  |            |
              level1-1      level1-2
                               |
                          ------------
                         |            |
                     level2-1     level2-2
                                      |
                          ------------------------
                         |            |           |
                      level3-1   level3-2      level3-3

On level3-1 I want a menu that fetches all the folders on level3.

I still want the entire menu for level3 visible when I browse to level3-2 and level3-3, so I can navigate around on this level.

I also want to be able to make a level3 under the level2-1 node, that will work in the same way.

Anyone that can give me a hint on how to do this?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Siw Helen Thorslund

Friday 19 November 2004 6:18:55 am

I now built the menu like this:

	{section show=$node.depth|eq(3)}
	
			<a href={$node.url_alias|ezurl}>Info</a>
	
			{let root_node=fetch( content, node, hash( node_id, $node.node_id ) )
				 menuitems=fetch( content, list, hash( parent_node_id, $node.node_id,
													   class_filter_type, include,
													   class_filter_array, ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
													   sort_by, $root_node.sort_array ) )}
		
			{section var=menu loop=$menuitems}
					{section show=eq( $menu.object.content_class.identifier, "link" )}
						<span {eq( $module_result.path[1].node_id, $menu.node_id )|choose( '', 'class="selected"' )}>x<a href={$menu.data_map.location.content|ezurl}>{$menu.object.name|wash}</a></span>
					{section-else}
						{section show=eq( sum( $menu.index, 1 ), $menuitems|count )}
						<span class="last {eq( $module_result.path[1].node_id, $menu.node_id )|choose( '', 'selected' )}">|&nbsp;<a href={$menu.url_alias|ezurl}>{$menu.name|wash}</a></span>
						{section-else}
						<span {eq( $module_result.path[1].node_id, $menu.node_id )|choose( '', 'class="selected"' )}>|&nbsp;<a href={$menu.url_alias|ezurl}>{$menu.name|wash}</a></span>
						{/section}
					{/section}
			{/section}
		
			{/let}

	{section-else}
	
			<a href={$node.parent.url_alias|ezurl}>Info</a>
	
			{let root_node=fetch( content, node, hash( node_id, $node.parent.node_id ) )
				 menuitems=fetch( content, list, hash( parent_node_id, $node.parent.node_id,
													   class_filter_type, include,
													   class_filter_array, ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
													   sort_by, $root_node.sort_array ) )}
		
			{section var=menu loop=$menuitems}
					{section show=eq( $menu.object.content_class.identifier, "link" )}
						<span {eq( $module_result.path[1].node_id, $menu.node_id )|choose( '', 'class="selected"' )}>x<a href={$menu.data_map.location.content|ezurl}>{$menu.object.name|wash}</a></span>
					{section-else}
						{section show=eq( sum( $menu.index, 1 ), $menuitems|count )}
						<span class="last {eq( $module_result.path[1].node_id, $menu.node_id )|choose( '', 'selected' )}">|&nbsp;<a href={$menu.url_alias|ezurl}>{$menu.name|wash}</a></span>
						{section-else}
						<span {eq( $module_result.path[1].node_id, $menu.node_id )|choose( '', 'class="selected"' )}>|&nbsp;<a href={$menu.url_alias|ezurl}>{$menu.name|wash}</a></span>
						{/section}
					{/section}
			{/section}
		
			{/let}
		
	{/section}	

This so I have one menu at the depth of 3 and one at the depth of 4.

But when I use the back button, the depth is still 4...

How can I get around this?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Mark Marsiglio

Monday 22 November 2004 2:13:20 pm

This is the code that I normally use to accomplish this goal...(modified from another message on this forum)

<div id="leftmenunav"> 
<div id="navparent">
     	  {section name=parent loop=$module_result.path max=1 offset=1 }
               {section show=$parent:item.url}
                  <a href={$parent:item.url_alias|ezroot}>{$parent:item.text|wash}</a>
               {section-else}
    		      {$parent:item.text|wash}
               {/section}
    
         {/section}
</div>

{let docs=treemenu( $module_result.path, $module_result.node_id,
                    array( 'folder', 'infopage', 'article', 'flash', 'quicktime', 'partner'), 1, 5 ),
                    depth=1}
        <ul>
        {section var=menu loop=$:docs last-value}
            {section show=and( $menu.last.level|eq( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
            {section-else}
            {section show=and( $menu.last.level|gt( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
                    {"</ul>
                </li>"|repeat(sub( $menu.last.level, $menu.level ))}
            {/section}
            {/section}

            {section show=and( $menu.last.level|lt( $menu.level ), $menu.number|gt( 1 ) )}
                <ul>
                    <li class="menu-level-{$menu.level}">
            {section-else}
                <li class="menu-level-{$menu.level}">
            {/section}

            <a {$menu.is_selected|choose( '', 'class="selected"' )} href={$menu.url_alias|ezroot}>{$menu.text}</a>
			
            {set depth=$menu.level}
        {/section}
           </li>

        {section show=sub( $depth, 0 )|gt( 0 ) loop=sub( $depth, 0 )}
            </ul>
        </li>
        {/section}
        </ul>

{/let}

</div> {* id="leftmenunav" *}

This has an added function to show the parent folder because I do not show the root level in the tree menu, as the site sections are navigated with tabs.

Admittedly, I do not understand the code enough to troubleshoot it, but it usually works fine.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions