[RESOLU]Créer un variable smarty globale - Version imprimable +- Forum CMS Made Simple FR (https://forum.cmsmadesimple.fr) +-- Forum : Général (https://forum.cmsmadesimple.fr/forum-3.html) +--- Forum : Modules, Tags (https://forum.cmsmadesimple.fr/forum-14.html) +--- Sujet : [RESOLU]Créer un variable smarty globale (/thread-3778.html) |
[RESOLU]Créer un variable smarty globale - bobjo - 23/02/2016 Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~ Bonjour, Dans le cadre de la création d'un module je dois passer une variable à smarty. Il faudrait que cette variable soit globale, j’entends par globale qu'elle soit accessible de n'importe quel gabarit du CMS. J'ai esseyé avec $smarty->assignGlobal('nom','valeur') mais cela ne fonctionne pas. J'ai mis dans mon gabarit {get_template_vars} cela m'affiche si j'ai bien compris le variable connu de smarty. Ma variable s'y trouve bien mais quand je veux l'afficher il n'y a rien. Y a t'il un moyen ? Cordialement bobjo [RESOLU]Créer un variable smarty globale - jce76350 - 23/02/2016 Our brand new introduction to Module Writing Tutorial for CMSMS 2.0 is now available. En direct http://docs.cmsmadesimple.org/uploads/Module_Writing_Tutorial.pdf [RESOLU]Créer un variable smarty globale - bobjo - 23/02/2016 Bonjour ! Merci de me répondre. J'ai regardé le tuto que tu me met en lien mais je ne vois rien sur le variable globale dans smarty. Peut-être la fatigue de la journée... Je regarderai ça plus en détail demain. Cordialement bobjo [RESOLU]Créer un variable smarty globale - jce76350 - 23/02/2016 fait une recherche sur le forum En avec assignGlobal [RESOLU]Créer un variable smarty globale - Jean le Chauve - 23/02/2016 http://www.smarty.net/forums/viewtopic.php?p=89605&sid=63d60ce902cf3786a577140fede47890 Tu peux utiliser {assign tavariable scope=global} dans le gabarit. [RESOLU]Créer un variable smarty globale - bobjo - 25/02/2016 Merci de vos réponses. Au final j'ai utilisé la solution de Jean le Chauve. {assign tavariable scope=global} Cordialement bobjo |