RE : [SMARTY] Recursive menu, menu of menus

From: Date: Fri, 26 Sep 2003 13:03:03 +0000
Subject: RE : [SMARTY] Recursive menu, menu of menus
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10275@lists.php.net to get a copy of this message
I don't know a better way myself, but you can use the caching fonctionnality of Smarty to speed up your menu. I do the same thing as you for my menu and cache the template for an unlimited time. Every time the administrator modify something in the menu or sub menu (rarely), I clear the corresponding cache. It's fast and simple. -----Message d'origine----- De : Martin Kjeldsen [mailto:martin@iagency.dk] Envoyé : vendredi 26 septembre 2003 13:56 À : smarty-general@lists.php.net Objet : [SMARTY] Recursive menu, menu of menus Hi, I'm doing a recursive menu, that is a menu containing children menus. It has about 4-5 levels, but I don't want to limit the number of levels. I've done it in the following way index.tpl: {include file="menu.tpl" menu_items=$page->menu} menu.tpl <div style="clear:both;padding-left:10px;"> {foreach from=$menu_items item=menu_item} {$menu_item.name}<br /> {if $menu_item.has_subs} {include file="menu.tpl" menu_items=$menu_item.sub_menus} {/if} {/foreach} </div> This is just for testing as it will be more complex later on, but do any of you know of a faster way of doing this and does smarty have to read the menu.tpl every time is has to open a sub menu (that's a lot of times). Also this could be help for somebody trying to build a similar thing, but don't know anyway of doing it. Martin Kjeldsen -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#10275) next »