|
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 |
budylove Smarty n00b
Joined: 10 Jun 2008 Posts: 1
|
Posted: Tue Jun 10, 2008 10:40 am Post subject: Incrementer une valeur d'index smarty à l'affichage |
|
|
Bonjour
J'ai une petite question concernant l'utilisation de smarty et des variables
J'aimerai savoir si il est possible de modifier la valeur d'une variable?
Un exemple sera plus parlant
Imaginons que j'ai un tableau $Tab avec des valeurs ayant pour index 0->3
Afin de récupérer la valeur de l'index en cours je fait : {$smarty.section.Idx_loop.index }
J'obtiendrai donc les valeurs de 0->3
Ce qui me donne ce code la :
Code: |
{section name=Idx_loop loop=Tab}
<td><a href="index.php?menu={$smarty.section.Idx_loop.index}">{$Tab[Idx_loop]}</a></td>
{/section} |
Et cet affichage la :
index.php?menu=0 -> index.php?menu=3
Maintenant comment avoir cela ?
index.php?menu=1 -> index.php?menu=4
Code: |
{section name=Idx_loop loop=Tab}
<td><a href="index.php?menu={$smarty.section.Idx_loop.index+1}">{$Tab[Idx_loop]}</a></td>
{/section} |
En gros comment obtenir {$smarty.section.Idx_loop.index+1}
Merci
budy. |
|
Back to top |
|
mumuri Smarty Rookie
Joined: 06 Apr 2008 Posts: 27
|
|
Back to top |
|
edennnnn Smarty n00b
Joined: 30 Jun 2008 Posts: 3
|
Posted: Wed Jul 30, 2008 4:08 pm Post subject: |
|
|
utilise index_next plutot que index |
|
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
|