Re: Variable deep loops
| From: | Monte Ohrt | Date: | Tue, 31 Jul 2001 16:05:22 +0000 |
| Subject: | Re: Variable deep loops | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1302@lists.php.net to get a copy of this message | ||
You should know the depth of your submenu at the time you assign it to
the template, so you could assign a depth parameter to aid you when
displaying it. Or, you could pass your variable to a custom function
that figures it out and displays it.
Ivan Lopez wrote:
>
> I'm trying to figure how to display variable deep things like menus with an unknown level
> of submenus using smarty's templates
>
> I tried to do recursive includes like
>
> <!-- menu.tpl -->
> {section name=menu loop=$items}
> {$items[menu].title}
> {$items[menu].link}
> {if $items[menu].child}
> {include file=menu.tpl items=$items[menu].child}
> {/section}
> <!-- menu.tpl -->
>
> but it seems to have problems with the variable menu containing the loop index and the results
> are not as expected
>
> any alternatives to do the same thing?
>
> thanks in advance
>
> ivan
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/