Jump to content

PHP Tags


Recommended Posts

How can I enable <?php and <? tags in Prestashop? I have tried changing the setting of the $php_handling property on the $smarty global variable and also explicitly set it in the Smarty.class.php file on line 359.

 

I am running Prestashop 1.5.6.2.

 

At the moment, my php tags are being escaped so in the source code of the webpage, it has '<?php echo "test"; ?>' instead of 'test'.

Link to comment
Share on other sites

you can use php tags only in php files (controllers)

it's definitely bad idea to enable <php> in smarty template files.

 

 

if you still want to use php tags in smarty, try with this:
 

 

 

open config/smarty.config.inc.php and replace

require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
with
require_once(_PS_SMARTY_DIR_.'SmartyBC.class.php');


and

$smarty = new Smarty();
with
$smarty = new SmartyBC();

now you can use PHP code like this

{php}
 {/php} 
Link to comment
Share on other sites

×
×
  • Create New...