Re: [SMARTY] nested section?
| From: | Ajay Sharma | Date: | Thu, 13 Feb 2003 02:09:53 +0000 |
| Subject: | Re: [SMARTY] nested section? | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7708@lists.php.net to get a copy of this message | ||
Crap, forgot to reply to the list:
I think you're missing the $smarty->assign('stores',$stores) line that
should go right above the $smarty->display() line.
later,
ajay
PS. I think this example should go in the docs because I've wondered
how to do this for quite awhile...
On Wed, 2003-02-12 at 17:34, Steve wrote:
> In article <1045092464.29005.92.camel@lena.ispi.prv>,
> monte@ispi.net (Monte Ohrt) wrote:
>
> > {foreach from=$stores key=store item=stinfo}
> > {$store}
> > {foreach from=$stinfo item=item}
> > <a href="{$item.href}">{$item.name}</a>
> > {/foreach}
> > {/foreach}
> >
> > Monte
>
> Thank you, Monte, for putting up with my apparent shortsightedness...
> I don't get it. The following test.php and test.tpl don't produce any
> output. The header and footer are there, the body is empty. No error
> messages.
>
> Steve
>
>
> -----------Smarty/test.php---------------------------------------
>
> <?php
>
> require 'Smarty.class.php';
>
> $smarty = new Smarty;
>
> $smarty->compile_check = true;
> $smarty->debugging = true;
>
>
> $stores = Array (
> "Abc" => Array (
> Array (
> "href" => "dealer.php?id=18",
> "name" => "Alpha Services",
> ),
> Array (
> "href" => "dealer.php?id=19",
> "name" => "Beta Testers",
> ),
> Array (
> "href" => "dealer.php?id=20",
> "name" => "Gamma Technology",
> ),
> ),
> "Bcd" => Array (
> Array (
> "href" => "dealer.php?id=21",
> "name" => "Alpha Tech",
> ),
> Array (
> "href" => "dealer.php?id=22",
> "name" => "Beta Office",
> ),
> Array (
> "href" => "dealer.php?id=23",
> "name" => "Gamma Centre",
> ),
> ),
> );
>
>
> $smarty->display('test.tpl');
>
> ?>
> ------------------------------------------------------------------
>
> -----------Smarty/Templates/test.tpl--------------------------
>
> {include file="header.tpl" title=test}
>
>
> {foreach from=$stores key=region item=local_stores}
> {$region}
> {foreach from=$local_stores item=store}
> <a href="{$store.href}">{$store.name}</a>
> {/foreach}
> {/foreach}
>
>
> {include file="footer.tpl"}
>
> ------------------------------------------------------------------
> --
> steve@conceptualthink.com