[SMARTY] eval problem

Michael M <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Hi, I need your help with the EVAL function.

In PHP I have a list of 27 fields, like this:

$advert['act1'] = 'foo';
$advert['act2'] = 'bar';
...
$advert['act26'] = 'doo';
$advert['act27'] = 'da';

I know this smells like it should be an array, but for
particular reasons it is not. So the template looks
like this:
{$advert.act1}<br>
{$advert.act2}<br>
...
{$advert.act26}<br>
{$advert.act27}<br>

Can I replace this with a loop? Something like:
{section name=foo start=1 loop=27}
 {eval var="\$advert.act`$smarty.section.foo.index`"}
<br>
{/section}

The code above does not work, by the way. The line
{eval var="\$advert.act`$smarty.section.foo.index`"}
produces:
$advert.act1

If I add braces:
{eval var="{\$advert.act`$smarty.section.foo.index`}"}
it displays:
{\.act1"}

So I must be missing something here.

Thanks,
Mike

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.