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

{php} et les variables smarty

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


Joined: 18 Nov 2010
Posts: 3

PostPosted: Thu Nov 18, 2010 7:37 pm    Post subject: {php} et les variables smarty Reply with quote

Bonjour,
J'utilise depuis quelque temps Smarty, et j'ai quelque problème avec {php}{/php}.
Je n'arrive pas à utiliser les variables que j'ai assigné à smarty. Existe il un moyen?


Last edited by MyKiwi on Sun Feb 06, 2011 1:04 pm; edited 2 times in total
Back to top
View user's profile Send private message
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Fri Nov 19, 2010 1:10 pm    Post subject: Reply with quote

Bonjour,

Tu peux récupérer les variables assignées depuis php grâce à :

Code:

{php}

$variable = $this->get_template_vars('la_variable_recherchee');

// on peut egalement recuperer le tableau complet des variables assignees en ne saisissant aucun parametre a cette fonction

$tableau = $this->get_template_vars();

{/php}


http://www.smarty.net/docsv2/fr/api.get.template.vars.tpl


++ (penses à mettre le sujet en résolu Smile )
Back to top
View user's profile Send private message Send e-mail
MyKiwi
Smarty n00b


Joined: 18 Nov 2010
Posts: 3

PostPosted: Wed Dec 01, 2010 8:21 pm    Post subject: Reply with quote

Merci beaucoup Very Happy
Back to top
View user's profile Send private message
MyKiwi
Smarty n00b


Joined: 18 Nov 2010
Posts: 3

PostPosted: Sun Feb 06, 2011 1:08 pm    Post subject: Reply with quote

Euh, désolé pour le double poste, mais je n'arrive pas a le faire marcher avec la dernière version de Smarty (Smarty 3.0.6).

Lorsque je fais ceci:
Code:
{php}
$tableau = $this->get_template_vars();
print_r($tableau);

J'obtiens ceci:
Code:
Fatal error: Using $this when not in object context in D:\Dropbox\wamp\FTJ\_lib\Smarty\plugins\block.php.php(23) : eval()'d code on line 3


Si quelqu'un pouvais m'aider rapidement sa serait super sympa!
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