How do I add an 3rd level to the left menu?

Author Message

Andy Boston

Wednesday 08 September 2010 2:50:25 am

Hi,

4.3.0 install / ezflow with the left hand menu enabled.

I tried to increase the depth in the code flat_left.tpl but that didn't work.

can someone please point me in the right direction to get an extra level?

thanks in advance :)

Martin Ulrich

Wednesday 08 September 2010 1:17:18 pm

may be mistakes, but works for me

<code>

{def $left_menu_depth = $pagedata.current_menu|eq('LeftOnly')|choose( 1, 0 )
$left_menu_root_url = cond( $pagedata.path_array[ $left_menu_depth ].url_alias, $pagedata.path_array[ $left_menu_depth ].url_alias, $requested_uri_string )}
<h4><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $pagedata.path_array[ $left_menu_depth ].node_id)|ezurl}{else}{$left_menu_root_url|ezurl}{/if}>{$pagedata.path_array[ $left_menu_depth ].text}</a></h4>
{if ne( $pagedata.class_identifier, 'documentation_page' )}
{def $root_node=fetch( 'content', 'node', hash( 'node_id', $pagedata.path_array[$left_menu_depth].node_id ) )
$left_menu_items = fetch( 'content', 'list', hash( 'parent_node_id', $root_node.node_id,
'sort_by', $root_node.sort_array,
'data_map_load', false(),
'class_filter_type', 'include',
'class_filter_type', 'include',
'class_filter_array', ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ) ) )
$left_menu_items_count = $left_menu_items|count()
$li_class = array()
$a_class = array()
$current_node_in_path_2 = first_set( $pagedata.path_array[$left_menu_depth|inc].node_id, 0 )
$current_node_in_path_3 = first_set( $pagedata.path_array[$left_menu_depth|sum(2)].node_id, 0 )
$current_node_in_path_4 = first_set( $pagedata.path_array[$left_menu_depth|sum(3)].node_id, 0 ) {* Def der zusätzlichen Ebene *}
{if $left_menu_items_count}
<ul class="menu-list">
{foreach $left_menu_items as $key => $item}
{set $a_class = cond($current_node_in_path_2|eq($item.node_id), array("selected"), array())
$li_class = cond( $key|eq(0), array("firstli"), array() )}
{if $left_menu_items_count|eq( $key|inc )}
{set $li_class = $li_class|append("lastli")}
{/if}
{if $item.node_id|eq( $current_node_id )}
{set $a_class = $a_class|append("current")}
{/if}
{if eq( $item.class_identifier, 'link')}
<li{if $li_class} class="{$li_class|implode(" ")}"{/if}><div class="second_level_menu"><a {if eq( $ui_context, 'browse' )}href={concat("content/browse/", $item.node_id)|ezurl}{else}href={$item.data_map.location.content|ezurl} target="_blank"{/if}{if $a_class} class="{$a_class|implode(" ")}"{/if} title="{$item.data_map.location.data_text|wash}">{$item.name|wash()}</a></div>
{else}
<li{if $li_class} class="{$li_class|implode(" ")}"{/if}><div class="second_level_menu"><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $item.node_id)|ezurl}{else}{$item.url_alias|ezurl}{/if}{if $a_class} class="{$a_class|implode(" ")}"{/if}>{$item.name|wash()}</a></div>
{/if}
{if eq( $current_node_in_path_2, $item.node_id )} {* Anzeige der Subitems *}
{def $sub_menu_items = fetch( 'content', 'list', hash( 'parent_node_id', $item.node_id,
'sort_by', $item.sort_array,
'data_map_load', false(),
'class_filter_type', 'include',
'class_filter_array', ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini'
) ) )
$sub_menu_items_count = $sub_menu_items|count}
{if $sub_menu_items_count}
<ul class="submenu-list">
{foreach $sub_menu_items as $subkey => $subitem} {* 2. foreach-Schleife *}
{set $a_class = cond($current_node_in_path_3|eq($subitem.node_id), array("selected"), array())
$li_class = cond( $subkey|eq(0), array("firstli"), array() )}
{if $sub_menu_items_count|eq( $subkey|inc )}
{set $li_class = $li_class|append("lastli")}
{/if}
{if $subitem.node_id|eq( $current_node_id )}
{set $a_class = $a_class|append("current")}
{/if}
{if eq( $subitem.class_identifier, 'link')}
<li{if $li_class} class="{$li_class|implode(" ")}"{/if}><div class="third_level_menu"><a {if eq( $ui_context, 'browse' )}href={concat("content/browse/", $subitem.node_id)|ezurl}{else}href={$subitem.data_map.location.content|ezurl} target="_blank"{/if}{if $a_class} class="{$a_class|implode(" ")}"{/if} title="{$subitem.data_map.location.data_text|wash}">{$subitem.name|wash()}</a></div></li>
{else}
<li{if $li_class} class="{$li_class|implode(" ")}"{/if}><div class="third_level_menu"><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $subitem.node_id)|ezurl}{else}{$subitem.url_alias|ezurl}{/if}{if $a_class} class="{$a_class|implode(" ")}"{/if}>{$subitem.name|wash()}</a></div></li>
{/if}
{* aber hier von mir neu: *}
{if eq( $current_node_in_path_3, $subitem.node_id )}
{def $sub3_menu_items = fetch( 'content', 'list', hash( 'parent_node_id', $subitem.node_id,
'sort_by', $subitem.sort_array,
'data_map_load', false(),
'class_filter_type', 'include',
'class_filter_array', ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ) ) )
$sub3_menu_items_count = $sub3_menu_items|count}
{if $sub3_menu_items_count}
<ul class="sub3menu-list">
{foreach $sub3_menu_items as $subkey => $subitem} {* 3. foreach-Schleife der zusätzlichen Ebene *}
{set $a_class = cond($current_node_in_path_4|eq($subitem.node_id), array("selected"), array())
$li_class = cond( $subkey|eq(0), array("firstli"), array() )}
{if $sub3_menu_items_count|eq( $subkey|inc )}
{set $li_class = $li_class|append("lastli")}
{/if}
{if $subitem.node_id|eq( $current_node_id )}
{set $a_class = $a_class|append("current")}
{/if}
{if eq( $subitem.class_identifier, 'link')}
<li{if $li_class} class="{$li_class|implode(" ")}"{/if}><div class="four_level_menu"><a {if eq( $ui_context, 'browse' )}href={concat("content/browse/", $subitem.node_id)|ezurl}{else}href={$subitem.data_map.location.content|ezurl} target="_blank"{/if}{if $a_class} class="{$a_class|implode(" ")}"{/if} title="{$subitem.data_map.location.data_text|wash}">{$subitem.name|wash()}</a></div></li>
{else}
<li{if $li_class} class="{$li_class|implode(" ")}"{/if}><div class="four_level_menu"><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $subitem.node_id)|ezurl}{else}{$subitem.url_alias|ezurl}{/if}{if $a_class} class="{$a_class|implode(" ")}"{/if}>{$subitem.name|wash()}</a></div></li>
{/if}
{/foreach} {* Ende 3. foreach-Schleife der zusätzlichen Ebene *}
</ul> {* schließt das ul from additional level *}
{/if} {* end-if from additional level *}
{undef $sub_menu_items $sub_menu_items_count $sub3_menu_items }
{/if} {* end-if from 2. level *}
{/foreach} {* Ende 2. foreach-Schleife *}
</ul> {* schließt das ul from 2. level *}
{/if}
{/if}
</li>
{/foreach} {* Ende oberste foreach-Schleife *}
</ul>{* schließt das ul from 1. level *}
{/if}
{undef $root_node $left_menu_items $left_menu_items_count $a_class $li_class $current_node_in_path_2 $current_node_in_path_3}
{else}
<div class="contentstructure">
{def $current_node = fetch( content, node, hash( node_id, $current_node_id ) )
$chapter_container = fetch( content, node, hash( node_id, $current_node.path_array[$left_menu_depth|inc] ) )
$class_filter = ezini( 'TreeMenu', 'ShowClasses', 'contentstructuremenu.ini' )
$depth = is_set( $current_node.path_array[$left_menu_depth|sum(2)] )|choose( $left_menu_depth|sum(3), 0 )
$node_to_unfold = is_set( $current_node.path_array[$left_menu_depth|sum(2)] )|choose(0 , current_node.path_array[$left_menu_depth|sum(2)] )
$contentStructureTree = content_structure_tree( $chapter_container.node_id, $class_filter, $depth, 0, 'false', false(), $node_to_unfold )}
{include uri='design:simplified_treemenu/show_simplified_menu.tpl' contentStructureTree=$contentStructureTree is_root_node=true() skip_self_node=true() current_node_id=$current_node_id unfold_node=$node_to_unfold chapter_level=0}
{undef $current_node $chapter_container $class_filter $depth $node_to_unfold $contentStructureTree}
</div>
{/if}

</code>

_______________________

http://artenic.de ARTENIC - Publishing mit allen Mitteln!

Andy Boston

Friday 10 September 2010 5:57:57 am

Thank you Martin, that works perfectly :)

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 30 2025 00:18:33
Script start
Timing: Jan 30 2025 00:18:33
Module start 'layout'
Timing: Jan 30 2025 00:18:33
Module start 'content'
Timing: Jan 30 2025 00:18:33
Module end 'content'
Timing: Jan 30 2025 00:18:33
Script end

Main resources:

Total runtime0.0132 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 588.2656151.2266
Module start 'layout' 0.00430.0023 739.492236.6797
Module start 'content' 0.00650.0054 776.171998.1875
Module end 'content' 0.01200.0011 874.359441.9922
Script end 0.0131  916.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.001914.1957140.0001
Check MTime0.00096.7106140.0001
Mysql Total
Database connection0.00064.752410.0006
Mysqli_queries0.002418.544630.0008
Looping result0.00000.068810.0000
Template Total0.00096.810.0009
Template load0.00075.049210.0007
Template processing0.00021.677610.0002
Override
Cache load0.00043.226810.0004
General
dbfile0.001611.969780.0002
String conversion0.00000.038040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs