Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

parcourir un tableau

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
jeff
Smarty n00b


Joined: 24 Oct 2005
Posts: 2

PostPosted: Mon Oct 24, 2005 7:24 am    Post subject: parcourir un tableau Reply with quote

salut
j'utilise smarty dans une architecture mcv
mais je n'arrive pas a parcourir un tableau Embarassed

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
View user's profile Send private message
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Mon Oct 24, 2005 6:02 pm    Post subject: Reply with quote

et ça (pas testé) :

{section name=i loop=$menu1}
{$menu1[i].lien}<p />
{$menu1[i].nom< p/>
{/section}
Back to top
View user's profile Send private message Visit poster's website
jeff
Smarty n00b


Joined: 24 Oct 2005
Posts: 2

PostPosted: Mon Oct 24, 2005 7:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP