There is a best practise guide on smarty homepage. #1 is Do not embed PHP!
http://www.smarty.net/best_practices
Try this: {include_php file="/path/to/somefile.php"}
But notice:
{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.
So best way is to write a smarty plugin as explained by rodneyrehm