NYCPHP Meetup

NYPHP.org

[nycphp-talk] Smart variable syntax question

Cliff Hirsch cliff at pinestream.com
Wed Nov 8 18:17:58 EST 2006


Yeah, I think $smarty's eval function can't handle nesting.

I created this work-around. It's ugly, but it works:

{assign var="temp" value=$params[1]}
{$params[0]->Contracts.$temp.textkey}

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Donald J Organ IV
Sent: Wednesday, November 08, 2006 6:09 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Smart variable syntax question

there has to be some type of evaluate function in smarty because you 
want to evaluate $params[1] so i would start by looking for an evaluate 
function.
-------------
Cliff Hirsch wrote:
>
> I want this in a Smarty template:
>
> PHP equivalent: $params[0]->Contracts[$params[1]]['textkey']
>
> Smarty template: {$params[0]->Contracts.$params[1].textkey}
>
> This doesn't work. I can't figure out how to make the nested 
> ->Contract [ $var[n] } work in Smarty.
>
> Any ideas? David Mintz.hint, hint..
>
> Cliff Hirsch




More information about the talk mailing list