dan3d Posted May 27, 2014 Share Posted May 27, 2014 Bonjour, Ma demande concerne le passage d'une valeur accessible dans header.tpl pour l'utiliser dans blocktopmenu.php Est il possible de créer une variable sous smarty qui est accessible dans un fichier php. Je cherche pour "colorer" l'onglet du menu principal à avoir le numéro de la catégorie parente. Dans header.tpl je l'ai avec {$category->id_parent} Mais dans blocktopmenu.php comment faire? Je pensais que comme header.tpl est lu avant blocktopmenu.php , il y a moyen de l’afficher dans le code php. merci de votre aide. Link to comment Share on other sites More sharing options...
herve25 Posted May 27, 2014 Share Posted May 27, 2014 Bonjour, Tu peux essayer de récupérer les données via smarty avec la fonction getTemplatesVars() http://www.smarty.net/docs/en/api.get.template.vars.tpl $category = $this->context->smarty->getTemplateVars('category') Link to comment Share on other sites More sharing options...
dan3d Posted May 28, 2014 Author Share Posted May 28, 2014 Merci de votre réponse Mais getTemplatesVars() s'utilise dans un fichier php, non? (c'est une question) Mon besoin est de l'utiliser dans un fichier .tpl Donc, peut-on utiliser getTemplatesVars() dans un fichier .tpl ? car j'ai une erreur en utilisant dans un fichier .tpl je rapelle mon besoin utiliser la valeur {$category->id_parent} que j'ai dans header.tpl, dans blocktopmenu.php Link to comment Share on other sites More sharing options...
herve25 Posted May 28, 2014 Share Posted May 28, 2014 Bonjour, Votre demande initiale était de récupérer une variable smarty dans une page php Ma demande concerne le passage d'une valeur accessible dans header.tpl pour l'utiliser dans blocktopmenu.php Est il possible de créer une variable sous smarty qui est accessible dans un fichier php. Ce que fait la fonction getTemplatesVars() A ma connaissance ce n'est pas possible directement dans le tplMais vous trouverez peut être des infos ici : http://stackoverflow.com/questions/11799652/how-to-get-all-assigned-smarty-variables-while-running-the-template Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now