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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 20 2025 01:04:45
Script start
Timing: Jan 20 2025 01:04:45
Module start 'layout'
Timing: Jan 20 2025 01:04:45
Module start 'content'
Timing: Jan 20 2025 01:04:46
Module end 'content'
Timing: Jan 20 2025 01:04:46
Script end

Main resources:

Total runtime1.5112 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0088 589.1484152.6250
Module start 'layout' 0.00880.0039 741.773439.4297
Module start 'content' 0.01281.4968 781.2031564.0156
Module end 'content' 1.50960.0016 1,345.218816.5000
Script end 1.5112  1,361.7188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2346160.0002
Check MTime0.00150.0961160.0001
Mysql Total
Database connection0.00120.081110.0012
Mysqli_queries1.443995.5447570.0253
Looping result0.00080.0496550.0000
Template Total1.458196.520.7291
Template load0.00230.150720.0011
Template processing1.455996.336920.7279
Template load and register function0.00020.011910.0002
states
state_id_array0.00130.085010.0013
state_identifier_array0.00180.122020.0009
Override
Cache load0.00190.1263250.0001
Sytem overhead
Fetch class attribute can translate value0.00070.045120.0003
Fetch class attribute name0.00160.104650.0003
XML
Image XML parsing0.00100.066620.0005
class_abstraction
Instantiating content class attribute0.00000.001160.0000
General
dbfile0.00100.0682210.0000
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs