Forums / Setup & design / Problem with menues

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

eZ debug

Timing: Jan 19 2025 21:20:48
Script start
Timing: Jan 19 2025 21:20:48
Module start 'content'
Timing: Jan 19 2025 21:20:49
Module end 'content'
Timing: Jan 19 2025 21:20:49
Script end

Main resources:

Total runtime0.9025 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.9297180.8438
Module start 'content' 0.00530.7675 769.7734569.0938
Module end 'content' 0.77280.1297 1,338.8672341.0859
Script end 0.9025  1,679.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4421210.0002
Check MTime0.00150.1689210.0001
Mysql Total
Database connection0.00060.067310.0006
Mysqli_queries0.825991.50521940.0043
Looping result0.00200.21971920.0000
Template Total0.874696.920.4373
Template load0.00220.243320.0011
Template processing0.872496.666220.4362
Template load and register function0.00010.010410.0001
states
state_id_array0.00150.165010.0015
state_identifier_array0.00090.098920.0004
Override
Cache load0.00170.1910250.0001
Sytem overhead
Fetch class attribute can translate value0.00240.265030.0008
Fetch class attribute name0.00120.137650.0002
XML
Image XML parsing0.00130.145930.0004
class_abstraction
Instantiating content class attribute0.00000.001760.0000
General
dbfile0.00760.8375320.0002
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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