Promokit Posted January 27, 2012 Share Posted January 27, 2012 Hi. I creating some module on prestashop 1.5 version. How can I make visible smarty variable from this module in the header.tpl file? Thanks in advance Link to comment Share on other sites More sharing options...
Raphaël Malié Posted January 27, 2012 Share Posted January 27, 2012 Hello Marek, sorry I didn't understand your question. You define which variable in your module ? Regards Link to comment Share on other sites More sharing options...
Promokit Posted January 27, 2012 Author Share Posted January 27, 2012 I create a module with following code function hookHeader($params) { $setting = "test"; $this->smarty->assign( 'setting', $setting ); return ($this->display(__FILE__, 'setting.tpl')); } I want to use $setting variable in header.tpl file, but it is undefined. In the setting.tpl file I can use it without any problem. How can I use this variable in the header.tpl file? Thanks Link to comment Share on other sites More sharing options...
Raphaël Malié Posted January 27, 2012 Share Posted January 27, 2012 You have to use $this->context->smarty->assign() if you want to create a global variable usable in header.tpl When you use $this->smarty->assign() you only assign the var to the template setting.tpl. Regards Link to comment Share on other sites More sharing options...
Promokit Posted January 28, 2012 Author Share Posted January 28, 2012 Thank you very match! Its works! Link to comment Share on other sites More sharing options...
Recommended Posts