Hello, I would like to display a random text in my header but I can't put PHP in my TPL file. I tried to put PHP by using {php} but it's not working, does anybody have a lead on how to put PHP in a TPL file ? Best regards,
You have to name the framework you're working with for anyone to help you, cuz .tpl file are parsed differently in different software packages.
i fall in same situation few months ago forgot how i fixed that email your both php and tpl files i will try it
Thanks a lot for the proposition, but I managed to find a javascript code to do the random text and it's working with the {literate} tag
I've found the answer, create a file named block.php_code.php in your smarty plugin folder. With this code: function smarty_block_php_code($params, $content, &$smarty) { if (is_null($content)) { return; } if ('<?php' == substr($content,0,5) && '?>' == substr($content, -2)) $content = substr($content,5,-2); ob_start(); eval($content); return ob_get_clean(); } PHP: On your TPL you can use PHP like this : {php_code}{literal}<?php print "Hello, world!"; ?>{/literal}{/php_code} Code (markup):