Left menu sub-items

Author Message

Alexander Petrov

Monday 18 December 2006 3:23:16 am

Hello!

I'm using this template for displaying folder items and sub-items:

{def $second_level_children=array()}
{def $root_node_children=fetch('content', 'list', hash('parent_node_id', 119,  'sort_by', array('name', true())))}
 
{if gt($root_node_children|count,0)}
<ul>
{foreach $root_node_children as $child}
<li class="menu-level-0">
<a href={$child.url_alias|ezurl()}><span class="arrowz">&gt;&gt;</span>&nbsp; {$child.name|wash()} &nbsp;</a>
{if or(eq($child.node_id,$module_result.node_id),eq($module_result.path.1,$child.node_id))}
{set $second_level_children=fetch('content','list',hash('parent_node_id', $child.node_id))}
{if gt($second_level_children|count,0)}
<ul>
{foreach $second_level_children as $child2}
<li class="menu-level-1"><a href={$child2.url_alias|ezurl()}><span class="arrowz">&gt;</span>&nbsp; {$child2.name|wash()} &nbsp;</a></li>
{/foreach}
</ul>
{/if}
{/if}
{/foreach}
</ul>
{/if}

The content tree for this menu is looking like this :

// Root
 --- item 
 --- item 
     -- sub-item
     -- sub-item
     -- etc...

 --- item 
 --- item 
 --- item 
 --- etc..

When I'm opening sub-folder the sub-subitems are displaying in the left menu, but when I click on sub-subitem folder the menu is displaying only the contents of the root folder.
How to make this code to fetch the subitems while viewing the sub-sub folder?

Jon Staines

Monday 18 December 2006 5:46:03 am

In your if statement, try changing the $module_result.path.1 into $module_result.path.1.node_id

Alexander Petrov

Tuesday 19 December 2006 3:15:22 am

Hello Jon!

I'v changed the statement so it looks now like this:

{if or(eq($child.node_id,$module_result.node_id),eq($module_result.path.1.node_id,$child.node_id))}

But there's no effect, them menu behaviour is the same. ((

Jon Staines

Tuesday 19 December 2006 3:50:03 am

Sorry, when testing it I had set the root node id of the menu to 2, whereas you have a folder further down. You need to change the part of the path you need depending on how deep the root folder is.

If you had:

--root
  --news
    --test folder
      --child folder
        --deep folder
    --another folder
  --polls

and you wanted the left menu to look within the news folder instead of root, you would need:

$module_result.path.2.node_id

instead of:

$module_result.path.1.node_id

Just increase the number the more layers down you go.
Hope this makes sense.

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 18 2025 22:17:05
Script start
Timing: Jan 18 2025 22:17:05
Module start 'layout'
Timing: Jan 18 2025 22:17:05
Module start 'content'
Timing: Jan 18 2025 22:17:06
Module end 'content'
Timing: Jan 18 2025 22:17:06
Script end

Main resources:

Total runtime1.0562 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 589.0234152.6250
Module start 'layout' 0.00820.0031 741.648439.4297
Module start 'content' 0.01131.0431 781.0781524.4219
Module end 'content' 1.05430.0018 1,305.500012.1875
Script end 1.0561  1,317.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3354160.0002
Check MTime0.00150.1390160.0001
Mysql Total
Database connection0.00270.259210.0027
Mysqli_queries0.996094.3009600.0166
Looping result0.00060.0559580.0000
Template Total1.017296.320.5086
Template load0.00250.235020.0012
Template processing1.014896.080120.5074
Template load and register function0.00030.025410.0003
states
state_id_array0.00090.085910.0009
state_identifier_array0.00120.110020.0006
Override
Cache load0.00190.1842290.0001
Sytem overhead
Fetch class attribute can translate value0.00080.078420.0004
Fetch class attribute name0.00110.101250.0002
XML
Image XML parsing0.00070.063320.0003
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00090.0875160.0001
String conversion0.00000.000940.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs