|
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 |
skeut Smarty n00b
Joined: 14 May 2007 Posts: 1
|
Posted: Mon May 14, 2007 8:18 am Post subject: Récupérer une variable dans 1 fichier |
|
|
Bonjour,
Je suis nouveau dans le forum et pour smarty.
Dans mon template, comment récupérer une variable qui se trouven dans 1 autre fichier et l'afficher?
merci
skeut |
|
Back to top |
|
Nasga Smarty n00b
Joined: 30 May 2007 Posts: 2
|
Posted: Thu May 31, 2007 10:54 am Post subject: Récupérer une variable dans 1 fichier |
|
|
Cela dépend de ce que tu entend par autre fichier.
Si tu souhaite afficher dans un template, la valeur d'une variable php il te suffit de taper :
Dans ton fichier php :
Code: | $var = 'coucou';
$smarty = new smarty();
$smarty->assign('mavariable',$var);
$smarty->display('template.tpl'); |
N'oublie pas bien sur d'inclure la classe smarty et de definir les différents paramètres.
Dans ton fichier template.tpl :
Code: | <p>ma variable est {$mavariable}</p> |
J'éspère avoir répondu à ta question. _________________ "Vi veri veniversum vivus vici."
Faust. |
|
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
|