Forums / Developer / Treemenu working fine in pagelayout.tpl but no othet .tpl

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Treemenu working fine in pagelayout.tpl but no othet .tpl

Author Message

Koos TDK

Wednesday 13 October 2004 3:14:13 am

Hi!

I think I am missing something obvious, the below code works fine in pagelayout.tpl but does not work when in another template file. Any help much appreciated. I get the following errors:

Unknown template variable 'module_result' in namespace '' 
Error: eZTemplate Oct 13 2004 11:55:31 
Unknown template variable 'module_result' in namespace '' 
{* START tree menu *}
<div id="treemenu" class="treemenu">

<div id="treemenu_navparent" class="treemenu_navparent">
       {section name=parent loop=$module_result.path max=1 offset=1 }
             {section show=$parent:item.url}
                  <a href={$parent:item.url_alias|ezurl}>{$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( 'cp_company', 'product', 'folder', 'person', 'article', 'gallery', 'company' ), 2, 5 ) 
                    depth=6} {* wow! It will only list the classes listed in here, i.e. 'article' or 'cp_company' and nothing else! *} 
        <ul class="top_choices">
        {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="treemenu_selected"' )} href={$menu.url_alias|ezurl}>{$menu.text|shorten( 25 )}</a>

            {set depth=$menu.level}
        {/section}
           </li>

        {section show=sub( $depth, 0 )|gt( 0 ) loop=sub( $depth, 0 )}
            </ul>
        </li>
        {/section}
        </ul>

{/let}

</div>
{* END tree menu *}