|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jeff Smarty n00b
Joined: 24 Oct 2005 Posts: 2
|
Posted: Mon Oct 24, 2005 7:24 am Post subject: parcourir un tableau |
|
|
salut
j'utilise smarty dans une architecture mcv
mais je n'arrive pas a parcourir un tableau
voici mon tableau Code: |
Array
(
[menu1] => Array
(
[0] => Array
(
[lien] => 28
[nom] => produit
)
[1] => Array
(
[lien] => 29
[nom] => formation
)
)
} |
et ma boucle smarty
Code: | {foreach from=menu1 item=item key=key name=menu}
<li><a href="{$item.lien}">{$item.nom}</a></li>
{/foreach} |
il m'affiche "m"
merci |
|
Back to top |
|
thiebo Smarty Pro
Joined: 16 Jan 2005 Posts: 144 Location: Paris
|
Posted: Mon Oct 24, 2005 6:02 pm Post subject: |
|
|
et ça (pas testé) :
{section name=i loop=$menu1}
{$menu1[i].lien}<p />
{$menu1[i].nom< p/>
{/section} |
|
Back to top |
|
jeff Smarty n00b
Joined: 24 Oct 2005 Posts: 2
|
Posted: Mon Oct 24, 2005 7:00 pm Post subject: |
|
|
j'ai fait mon boulet, ca fait trois semaine que ce truc est en suspend
en fait la solution c'est Code: | {foreach from=$menu1 item=item key=key name=menu}
<li><a href="{$item.lien}">{$item.nom}</a></li>
{/foreach} |
tout ca pour "$"
merci d'avoir repondu |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|