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

Boucle et affichage sur 2 colonnes ?

 
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
fgilain
Smarty Rookie


Joined: 14 Oct 2006
Posts: 9

PostPosted: Thu Dec 21, 2006 10:20 am    Post subject: Boucle et affichage sur 2 colonnes ? Reply with quote

Bonjour,

J'ai un code qui fonctionne actuellement, mais j'aimerais maintenant que la boucle affiche 2 résultats (2 liens vers une autre page en fait) par ligne et donc créer 2 colonnes au lieu d'1...

code actuel :

Code:

<h2><span class="deco">></span>Catalogue par éditeur</h2><br />
    <table>
      {section name=tab_editeurs loop=$tab_editeurs}
        <tr>
        <td>
       <img src="{$urlsite}css/puce2.gif" alt="" /> <a href="{$urlsite}catalogue-editeur-{$tab_editeurs[tab_editeurs].nom}-e{$tab_editeurs[tab_editeurs].id_editeur|urlencode}"><b>{$tab_editeurs[tab_editeurs].nom|utf8_encode|strtolower|ucwords}</b></a>
       {if $show_details == "1"} ({$tab_editeurs[tab_editeurs].nbr_online_products} produits){/if}
       <br />
      </td> 
         </tr>
      {/section}
    </table>


Je suis dessus depuis 1 heure et là, je cale..

PS : j'utilise smarty 2.6.2

Merci de votre coup de pouce

Florent


Last edited by fgilain on Sun May 02, 2010 10:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
fgilain
Smarty Rookie


Joined: 14 Oct 2006
Posts: 9

PostPosted: Thu Dec 21, 2006 10:39 am    Post subject: Reply with quote

en gros, aujourd'hui, ca me donne une liste de noms d'éditeurs de livres les uns en dessous des autres, précédés par une petite fleche pour faire joli...et donc le lien ressemble à :

http://www.monsite.com/fr/catalogue-editeur-lenomdelediteur-e10 (où e10 = editeur d'id 10 grace a de l'url rewrite...)

si ça peut aider à la compréhension du code Wink

Florent


Last edited by fgilain on Sun May 02, 2010 10:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
fgilain
Smarty Rookie


Joined: 14 Oct 2006
Posts: 9

PostPosted: Thu Dec 21, 2006 3:50 pm    Post subject: Reply with quote

sinon, j'ai ça, mais j'ai du rater une incrementation d'index quelque part :

Code:

<table border=1>
   {$smarty.section.tab_editeurs.total} éditeurs ont été trouvés :
  {section name=tab_editeurs loop=$tab_editeurs step=2}
  <tr>
    {section name=td start=$smarty.section.tab_editeurs.index loop=$smarty.section.tab_editeurs.index+1}
    <td>
    <img src="{$urlsite}css/puce2.gif" alt="" /> <a href="{$urlsite}catalogue-editeur-{$tab_editeurs[tab_editeurs].nom}-e{$tab_editeurs[tab_editeurs].id_editeur|urlencode}"><b>{$tab_editeurs[tab_editeurs].nom|utf8_encode|strtolower|ucwords}</b></a>
    {if $show_details == "1"} ({$tab_editeurs[tab_editeurs].nbr_online_products} produits){/if}
    </td>     
    <td>
    <img src="{$urlsite}css/puce2.gif" alt="" /> <a href="{$urlsite}catalogue-editeur-{$tab_editeurs[tab_editeurs.index_next].nom}-e{$tab_editeurs[tab_editeurs.index_next].id_editeur|urlencode}"><b>{$tab_editeurs[tab_editeurs.index_next].nom|utf8_encode|strtolower|ucwords}</b></a>
    {if $show_details == "1"} ({$tab_editeurs[tab_editeurs.index_next].nbr_online_products} produits){/if}
    </td>
    {/section}
  </tr>
  {/section}
</table>


Last edited by fgilain on Sun May 02, 2010 10:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
ciboulette
Smarty Regular


Joined: 13 Jul 2006
Posts: 45

PostPosted: Fri Dec 22, 2006 2:56 pm    Post subject: Reply with quote

tu a la fonction cycle de smarty http://smarty.php.net/manual/fr/language.function.cycle.php qui peu repondre a ton probleme.


et tu fait un truc un peu comme ça pour metre sur 2 colonne
Code:
{cycle values=",</tr><tr>"}">
Back to top
View user's profile Send private message
fgilain
Smarty Rookie


Joined: 14 Oct 2006
Posts: 9

PostPosted: Wed Dec 27, 2006 8:33 pm    Post subject: Reply with quote

aie aie aie, je suis un peu perdu là...mon probleme apparement, c'est que je dois boucler sur un tableau de tableau non ?
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