|
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 |
ZIG1 Smarty Rookie
Joined: 09 Feb 2006 Posts: 21 Location: Paris, France
|
Posted: Thu Feb 09, 2006 11:52 am Post subject: if exist ou empty ?? |
|
|
Bonjour,
je suis nouvelle, j'apprend smarty depuis hier ...
Et c'est ma première en poo ...
Bref c'est pas gagné ...
J'arrive a faire un certain nombre de chose, mais je ne sais pas tester si une variable est là ou pas dans un template.
En php j'aurais fait empty () ??? mais là ...
J'ai cherché sur la documentation ... et je ne trouve pas mais je ne sais pas dans case ils auraient pu le mettre.
Voilà merci d'avance pour votre aide _________________ ...:::ZIG1:::... |
|
Back to top |
|
demental Smarty Rookie
Joined: 11 Jan 2006 Posts: 20 Location: Lost in the French deeeeep countryside
|
Posted: Thu Feb 09, 2006 6:47 pm Post subject: |
|
|
Code: |
{if $mavariable}
faire un truc si mavariable est initialisée (ou pas false)
{/if}
|
ou
Code: |
{if $mavariable ne ''}
faire un truc si mavariable est initialisée (ou pas vide)
{/if}
|
|
|
Back to top |
|
jbenzakin Smarty Rookie
Joined: 09 Nov 2006 Posts: 6 Location: austin
|
Posted: Tue Dec 19, 2006 11:00 pm Post subject: testez |
|
|
{if $page eq index} //eq == equal (egale)
//fais quelque chose
{else}
//fais quelque chose d'autre
{/if}
ou tu peut faire {if $page ne index} //ne == not equal (pas egale)
tu peut aussi faire:
{if $page ne index && $page ne contact}
//fais quelque chose
{/if} |
|
Back to top |
|
ciboulette Smarty Regular
Joined: 13 Jul 2006 Posts: 45
|
Posted: Wed Dec 20, 2006 12:21 am Post subject: |
|
|
les 2 monsieur on raison pour moi un {if $mavariable} es largement suffisant dans la plupar des cas , mainenant n'oublie pas que smarty est la pour dissocié le code de l'affichage surtout , essaye avant de reflechire si php ne peu pas faire se que tu demande a smarty, si tu boss avec un webdesigner qui n'est pas forcement doué en dev ça lui facilitera la tache et a toi aussi en cas de mise a jours graphique. |
|
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
|