variable inside a variable or nested variables
| From: | Zilvinas Saltys | Date: | Wed, 21 Apr 2004 19:20:10 +0000 |
| Subject: | variable inside a variable or nested variables | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11283@lists.php.net to get a copy of this message | ||
Hello
I have this:
<?php
$langs = (en, ru);
$arr = (en => array ('header' => 'a'), ru => array ('header'
=> 'b'));
foreach ($langs as $lang)
{
$this->tpl->assign($lang, $arr[$lang]);
}
$this->tpl->assign($langs);
?>
In the template i have:
{foreach item=row from=$langs}
<input type="text" name="{$row}[header]" value="{${$row}.header}"
size="30" maxlength="100" />
{/foreach}
So the problem appears when i try to use {${$row}.header}... This does not work.
Is there a way to access my arrays en[] ru[] from this loop?
Thank you
Bye