PietroSAIinformatica Posted October 19, 2022 Share Posted October 19, 2022 (edited) Hi, this is my first time creating a module for prestashop and i'm stuck with sending a php variable to the tpl file. I'm using smarty for sending that variable but when i upload the module nothing get diplyed: What i did wrong? You have an idea? Thanks for your time and helps; my regards. Here i wrote down the code of it. In php file: public function test($params){ $smarty= new smarty(); $test='<h1>TEST</h1>'; $smarty->assign('TS',$test); $smarty->display('newmod.tpl'); } In tpl file: <div id="mymodule_block_home" class="block"> <div class="block_content"> <div> {$TS} </div> </div> </div> Edited October 19, 2022 by PietroSAIinformatica Miss wrote the code in the tpl file part (see edit history) Link to comment Share on other sites More sharing options...
JBW Posted October 19, 2022 Share Posted October 19, 2022 56 minutes ago, PietroSAIinformatica said: $smarty->assign('TS',$test); You named the Smarty variable as 'TS', so you have to access it in smarty as {$TS} Link to comment Share on other sites More sharing options...
PietroSAIinformatica Posted October 19, 2022 Author Share Posted October 19, 2022 (edited) 4 hours ago, JBW said: You named the Smarty variable as 'TS', so you have to access it in smarty as {$TS} yeah sorry i inverted them but even in the right way it gaves me problem. I was pretty sure about it but i checked and the results are the same. Thank you for pointing out this error i edit the topic now and correct it Edited October 19, 2022 by PietroSAIinformatica (see edit history) 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