bsphere Posted March 24, 2009 Share Posted March 24, 2009 I would like to add a php code (with the <?php ?> tags) to a .tpl file (such as editorial.tpl and blockadvertising.tpl) in order to add openx banners.simply adding the php code and the tags doesn't work,how can it be done? Link to comment Share on other sites More sharing options...
rocky Posted March 25, 2009 Share Posted March 25, 2009 Hi bsphere,I'm not sure whether it is possible to add PHP code to TPL files, but it shouldn't be. You should instead put it in the appropriate PHP file, then pass the results of the PHP into the TPL file.For example, in the PHP file: $output = phpfunction(); $smarty->assign('output', $output); $smarty->display(_PS_THEME_DIR_.'template.tpl'); Then in the TPL file, simply put the following code wherever you want to put the PHP: {$output} Link to comment Share on other sites More sharing options...
123dev Posted March 25, 2009 Share Posted March 25, 2009 You can put php code in your smarty tpl between {php}php_code{/php} Link to comment Share on other sites More sharing options...
frosticek Posted March 21, 2011 Share Posted March 21, 2011 Hi bsphere,I'm not sure whether it is possible to add PHP code to TPL files, but it shouldn't be. You should instead put it in the appropriate PHP file, then pass the results of the PHP into the TPL file.For example, in the PHP file: $output = phpfunction(); $smarty->assign('output', $output); $smarty->display(_PS_THEME_DIR_.'template.tpl'); Then in the TPL file, simply put the following code wherever you want to put the PHP: {$output} I am still getting error 500 in second line: $smarty->assign('output', $output);I assign to output numerical value from some php function but still getting error. Link to comment Share on other sites More sharing options...
Recommended Posts