Re: [SMARTY] variable name problem
| From: | Guillaume Justier | Date: | Wed, 07 May 2003 17:17:00 +0000 |
| Subject: | Re: [SMARTY] variable name problem | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9496@lists.php.net to get a copy of this message | ||
Luc, Messju,
Thanks for your help.
I'm almost there, using the ideas you gave me earlier today.
The following code works:
{foreach from=$searchloop key=keyid item=currid}
{assign var="incoming" value="FORM_CHRG-$keyid-INCOMING"}
{strip}
<tr bgcolor="{cycle values="#aaaaaa,#bbbbbb"}">
<td align="center">{label for="$incoming"}</td>
<td>{input name="$incoming"}</td>
</tr>
{/strip}
{/foreach}
Note that I have to use - (minus sign) because if I try this:
{assign var="incoming" value="FORM_CHRG_$keyid_INCOMING"}
with underscore, it doesn't work !!!
Nevermind I thought, it does the job with a minus sign...
But now I have an issue, because I am using javascript on those fields, and
the minus sign is not a legal char in JS for variable names....
So I have no choice but to get it to work with underscore...
Does anyone knows why :
{assign var="incoming" value="FORM_CHRG_$keyid_INCOMING"}
is not valid ?
Thanks in advance,
Guillaume
www.inmeres.com
----- Original Message -----
From: "Guillaume Justier" <newsgroup@inmeres.com>
To: "smarty" <smarty-general@lists.php.net>
Sent: Wednesday, May 07, 2003 9:41 AM
Subject: [SMARTY] variable name problem
> Hi guys,
>
> I have a problem with variable names.
> Within a loop I have the following line:
>
> {label for="FORM_CHRG_".{$searchloop[mysc].PK}."_TITLE"}
>
> Is this the correct syntax to generate the variable name (for example :
> {label for="FORM_CHRG_3_TITLE"})
>
> Thanks in advance,
>
> Guillaume
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>