|
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 |
nicolasz Smarty n00b
Joined: 11 Aug 2011 Posts: 2
|
Posted: Thu Aug 11, 2011 9:48 am Post subject: Réccupérer la valeur d'une dans une section |
|
|
Bonjour,
Je cherche à récupérer la valeur d'une variable dans la boucle antérieur d'une section.
Je sais qu'il existe index_prev pour récupérer l'indexe de la variable antérieur mais est ce que je peux récupérer une variable antérieur.
Le code vous aidera à mieux comprendre ce que je veux faire.
Code: |
{section name="produtcs" loop="$produtcs" max=6}
{if $produtcs[produtcs].categoryName != $produtcs[produtcs].categoryName d'avant}
{$produtcs[produtcs].categoryName}
{/if}
{/section}
|
|
|
Back to top |
|
Code62 Smarty Rookie
Joined: 21 Jun 2011 Posts: 12 Location: Work@Liège.be
|
Posted: Mon Sep 19, 2011 9:34 am Post subject: |
|
|
Salut,
Ceci pourrait répondre à ton besoin (si je l'ai bien compris -- et si tu n'as pas reglé la question toi-meme, au bout de plus d'un mois ^^"):
Code: | {section name="produtcs" loop="$produtcs" max=6}
{if !$PREVIOUS_CAT || $produtcs[produtcs].categoryName != $PREVIOUS_CAT}
{$produtcs[produtcs].categoryName}
{assign var="PREVIOUS_CAT" value=$produtcs[produtcs].categoryName}
{/if}
{/section} |
|
|
Back to top |
|
nicolasz Smarty n00b
Joined: 11 Aug 2011 Posts: 2
|
Posted: Mon Sep 19, 2011 12:51 pm Post subject: [resolu] |
|
|
Bonjour,
J'ai réussi à résoudre par un autre moyen.
Celle-ci semble fonctionner.
Dans tout les cas ca pourra aider les autres utilisateurs. |
|
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
|