The smarty homepage has a guide to best practices. # 1 - do not embed PHP!
http://www.smarty.net/best_practices
Try the following: {include_php file="/path/to/somefile.php"}
But note:
{include_php} is deprecated from Smarty, use registered plugins
to properly insulate presentation from the application code.
As of Smarty 3.1 the {include_php} tags are only available
from SmartyBC.
This is the best way to write a smarty plugin, as Rodneyrehm explained
source
share