| Alexandre Cognard 2006-03-20, 7:00 pm |
| Work fine, thanks !
Can we hope a better integration of array in future ?=20
Smarty is greatful :)
-----Message d'origine-----
De=A0: Pedro [mailto:daffodil@daffodil.uk.com]=20
Envoy=E9=A0: lundi 20 mars 2006 17:02
=C0=A0: smarty-general@lists.php.net
Objet=A0: [SMARTY] Re: Variable into smarty array
instead of {$poste[$offre[1].id_poste]}
which the smarty parser dont like
try assigning the array_key to a variable first
{assign var=3Darray_key value=3D$offre[1].id_poste}
{$poste[$array_key]}
regards
Pete
Alexandre Cognard wrote:
> Hi everyone,
>=20
> I often need to use var inside array.
>=20
> Example:
> $poste =3D array("1"=3D>"poste1", "2"=3D>"poste2", "3"=3D>"poste3");
> $offre =3D array("1"=3D>array("nom"=3D>"myname","id_poste"=3D>"1")); =
(result from
a
> db query)
>=20
> I assign these array to smarty.
>=20
> Then into smarty:
> {$poste[1]} =3D> Poste1;
>=20
> {$offre[1].nom} =3D> myname
> {$offre[1].id_poste} =3D> 1
>=20
> But {$poste[$offre[1].id_poste]} result to an error.
> I try many syntax, but cant achieve my objective.
>=20
> 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).
>=20
> Regards,
> Alexandre Cognard
--=20
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|