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

Récupérer une variable dans 1 fichier

 
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
skeut
Smarty n00b


Joined: 14 May 2007
Posts: 1

PostPosted: Mon May 14, 2007 8:18 am    Post subject: Récupérer une variable dans 1 fichier Reply with quote

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
View user's profile Send private message
Nasga
Smarty n00b


Joined: 30 May 2007
Posts: 2

PostPosted: Thu May 31, 2007 10:54 am    Post subject: Récupérer une variable dans 1 fichier Reply with quote

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
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