[prev in list] [next in list] [prev in thread] [next in thread]
List: smarty-general
Subject: Re: [SMARTY] Working with arrays recursively
From: Ken Snyder <ksnyder () coremr ! com>
Date: 2007-09-01 3:32:47
Message-ID: 46D8DD5F.2000102 () coremr ! com
[Download RAW message or body]
Christoph Boget wrote:
>> To recurse, you must include a template that includes itself to
>> trek deeper into the array.
>>
>
> Do you have an example? How do you keep the variables from overwriting
> one another?
>
> thnx,
> Christoph
>
parameters can be assigned to the include file using {include} to avoid
overwriting--example below. - ken
main.tpl:
{include file="recurse.tpl" parents=$tree level=0}
recurse.tpl
{foreach from=$parents item=child}
{$child.name}
{if $child.children}
{include file="recurse.tpl" parents=$child.children level=$level+1}
{/if}
{/if}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic