Forums / Setup & design / treemenu doesn't show up
Joyce Ouchida
Thursday 27 April 2006 2:50:21 pm
I have used the code sample under 'treemenu' in Documentation (http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/miscellaneous/treemenu) in my pagelayout, but nothing is generated. I have changed the code to the minimum, as follows:
<ul> {def $mainMenu = treemenu( $module_result.path, $module_result.node_id)} {foreach $mainMenu as $menu} <li class="level_{$menu.level}"> <a href={$menu.url_alias|ezurl}>{$menu.text}</a> </li> {/foreach} </ul>
and still nothing. Is this code supposed to retrieve all subtrees in the system? What am I doing wrong?
Thanks for any help.
Mads Ovesen
Friday 28 April 2006 3:03:33 am
The code looks right. For some reason your $mainMenu array is empty. Check $module_result.path og $module_result.node_id to see if they are set properly.
/M
/m
David Barber
Tuesday 09 May 2006 11:31:56 am
I had exactly the same problem, using the syntax provided in the Learning eZ publish 3 book. I went looking, and found this response on a French forum (if you don't read French, take a look at the code near the bottom)
http://ezpublish-france.fr/index.php/fr/forums/questions_techniques/menu_gauche_fonction_treemenu
It isn't exactly the same, in that it only generates a menu from whichever node you give it, but it's very clean code, which I appreciate. Of course, you can substitute 'tree' for 'list' to get everything below the current node.
David