Re: [SMARTY] variable name problem

From: Date: Wed, 07 May 2003 21:49:33 +0000
Subject: Re: [SMARTY] variable name problem
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9500@lists.php.net to get a copy of this message
On Wed, May 07, 2003 at 10:38:03PM +0100, Guillaume Justier wrote: > Hi David, > > Thanks for putting me on the good track, I found the backtick syntax on the > smarty site thanks to your mail. > However, it still doesn't work!! > I have done some various tests, as shown below: > Result wanted : FORM_CHRG_11_INCOMING > > test 1 (not good): > {assign var="incoming" > value="FORM_CHRG_$keyid_INCOMING"} > {$incoming} > result 1 : FORM_CHRG_11_INCOMING you need Smarty-2.5.0 to make the backticks-notation work. your output looks like 2.4.2. or you can try a modifier (use 2 cats or an sprintf): {assign var="incoming" value="FORM_CHRG_%d_INCOMING"|sprintf:$keyid} (%d for numeric $keyid, %s instead of %d for strings) {assign var="incoming" value="FORM_CHRG_"|cat:$keyid|cat:"_INCOMING"} > test 2 (not good): > {assign var="incoming" value="FORM_CHRG_$keyid_INCOMING"} > {$incoming} > result 2 : FORM_CHRG_ > > > test 3 (not good): > {assign var="incoming" value="FORM_CHRG-$keyid-INCOMING"} > {$incoming} > result 3 : FORM_CHRG_11_INCOMING (this kinda works presumably because - act > as a delimiter) > > > test 4 (not good): > {assign var="incoming" value="FORM_CHRG{$keyid}INCOMING"} > {$incoming} > result 4 : FORM_CHRG_{11 > > I am not quite sure what to try now !!! > > Does anybody know how to fix that ? > > Thanks in advance, > > Best regards, > Guillaume > www.inmeres.com > > ----- Original Message ----- > From: "Wom.bat" <wom.bat@gmx.net> > To: "Guillaume Justier" <newsgroup@inmeres.com> > Cc: <smarty-general@lists.php.net> > Sent: Wednesday, May 07, 2003 6:20 PM > Subject: Re: [SMARTY] variable name problem > > > > > Does anyone knows why : > > > {assign var="incoming" value="FORM_CHRG_$keyid_INCOMING"} > > > is not valid ? > > > > try the backtick syntax: > > > > {assign var="incoming" > > value="FORM_CHRG_$keyid_INCOMING"} > > > > > > Cheers, > > David > > > > > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#9500) next »