Variable into smarty array
| From: | Alexandre Cognard | Date: | Mon, 20 Mar 2006 15:55:28 +0000 |
| Subject: | Variable into smarty array | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13370@lists.php.net to get a copy of this message | ||
Hi everyone,
I often need to use var inside array.
Example:
$poste = array("1"=>"poste1", "2"=>"poste2",
"3"=>"poste3");
$offre =
array("1"=>array("nom"=>"myname","id_poste"=>"1"));
(result from a
db query)
I assign these array to smarty.
Then into smarty:
{$poste[1]} => Poste1;
{$offre[1].nom} => myname
{$offre[1].id_poste} => 1
But {$poste[$offre[1].id_poste]} result to an error.
I try many syntax, but cant achieve my objective.
Is there's a way ? Or I need to do it into php (I do it most of time, but
not very appropriate in whole case).
Regards,
Alexandre Cognard