Using PHP code in Smarty tpl FIle

jawad waheed picture jawad waheed · Sep 16, 2011 · Viewed 55.7k times · Source

I am new to smarty and I want to use php code in template file i-e tpl file. I have seen the documentation and searched on google but could not find how to use php code they say we need to configure smarty to allow php execution but could not find how to do it.

Kindly help me in this regard. Thanks

Answer

Prisoner picture Prisoner · Sep 16, 2011

Easy as boiling an egg!

{php}echo "hello!"{/php}

Second link down, for reference.

Edit as of Smarty 3.1:

As of Smarty 3.1 the {php} tags are only available from SmartyBC.

Source: http://www.smarty.net/docs/en/language.function.php.tpl