[nycphp-talk] Smart variable syntax question
Rob Marscher
rmarscher at beaffinitive.com
Wed Nov 8 18:58:28 EST 2006
I'm not sure if it will work in this particular case... but sometimes
putting backticks like this will get it to parse it the way that you want:
{$params[0]->Contracts.`$params[1].textkey`}
I know I've still had to resort to using assign in some cases though.
-Rob
Cliff Hirsch wrote:
> 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
>>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
More information about the talk
mailing list