falkenbergweb Posted June 26, 2012 Share Posted June 26, 2012 I need to make one of the .tpl files print out some php code. I have read that Prestashop by default and for security reasons has turned off the ability to use {php} {/php}, so that is not the way. I know that it probably would be optimal to use smarty tags and the code inside the .php files and send it to the .tpl files. But i have no idea to use smarty. Maybe a simple example how to write some php code and make it print through the tpl file would be a solution. Tnx Link to comment Share on other sites More sharing options...
NuBlue Posted June 27, 2012 Share Posted June 27, 2012 You might be able to enable {php}, or alternatively, use {include} which functions just like PHP's include function. Link to comment Share on other sites More sharing options...
spiffyd Posted October 17, 2012 Share Posted October 17, 2012 (edited) I tried the following but couldn't get inserting php inside a tpl template file able to work: I create a test.php file with a simple echo('Hello World!'); and placed it in my root directory. At the end of my theme's footer.tpl I tried to add: { include file="../test.php" } { include file="http://domain.com/test.php" } { include_php file="../test.php" } { include_php file="http://domain.com/test.php" } {php} include('http://domain.com/test.php');} {/php} {php} include('../test.php');} {/php} I even went into smarty.config.inc.php in the config folder and added $smarty->allow_php_tag = true; Any suggestions on what I could be doing wrong? Edited October 17, 2012 by spiffyd (see edit history) Link to comment Share on other sites More sharing options...
Dreamtheme Posted October 17, 2012 Share Posted October 17, 2012 PrestaShop has disabled php in tpl files for security reasons. Link to comment Share on other sites More sharing options...
spiffyd Posted October 17, 2012 Share Posted October 17, 2012 Thanks for the update. Do you think it's possible to add a modify or override the IndexController.php file to include a function that can call for a PHP file then calling this function in the tpl file? If yes, how would I do this? Link to comment Share on other sites More sharing options...
Nrnaveen Posted July 21, 2014 Share Posted July 21, 2014 hai there is any way to execute a tpl file with out php Link to comment Share on other sites More sharing options...
vekia Posted July 21, 2014 Share Posted July 21, 2014 it's agains MVC model which is a part of idea of smarty and prestashop. you can include tpl file from other .tpl file but of course in "background" will be always some controller that handles first .tpl file what you exactly trying to achieve? Link to comment Share on other sites More sharing options...
Recommended Posts