Problem with an advanced side menu

Author Message

christian bencivenni

Thursday 03 January 2008 12:35:08 am

Hi.
I trying to make a new left menu with advanced function but I found a problem.
I want a menu with a first level equal to top menu so I used come code from the flat_top.tpl menu.
The complete code is:

{def  $root_node=fetch( 'content', 'node', hash( 'node_id', $indexpage ) )
       $top_menu_items=fetch( 'content', 'list', hash( 
               'parent_node_id', $root_node.node_id,
               'sort_by', $root_node.sort_array,
               'class_filter_type', 'include',
               'class_filter_array', ezini( 'MenuContentSettings', 'TopIdentifierList', 'menu.ini' ) ) )
       $top_menu_items_count = $top_menu_items|count()
       $item_class = array()
       $current_node_in_path = cond(and($current_node_id, 
          gt($module_result.path|count,$pagerootdepth)), 
           $module_result.path[$pagerootdepth].node_id, 0  )}
{set $pagerootdepth = $root_node.depth}

{if $top_menu_items_count}
{foreach $top_menu_items as $key => $item}

  {set $item_class = cond($current_node_in_path|eq($item.node_id), array("selected"),array())}
  <li>
    <a href="#">{$item.name|wash()}</a>
    <ul>
        {def $inner_nodes=fetch( 'content', 'list', hash( 'parent_node_id', $item.node_id ) )}
        {foreach $inner_nodes as $node}
          <li><a href="{$node.url}">{$node.name|wash()}</a></li>	
        {/foreach}
  </ul>
</li>

{/foreach}
{/if}

For the first level menu is all ok and from main page the link works correctly.
The problem born when I navigate the site.
For example if I have an article named Article in home/events/article from the main page the link is good and is something like:

http://www.mydomain.com/index.php/eng/events/article

but if i'm viewing another article in the Events folder the link is:

http://www.mydomain.com/index.php/eng/events/events/article

Someone can tell me why? And how to block this error?
Thank you in advance

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