Since I haven't seen anyone post a solution on this, I'll post a couple methods I'm using.
To include a php file in a Smarty .tpl file, just do this:
{include_php file="/pathtofile/file.php"}
This seems to work pretty well, assuming you don't need to use any variables from Smarty.
You can also use actual PHP code too! Just do it like this:
{php}
php code goes here;
{/php}
For this to work, you have to set the $php_handling variable to SMARTY_PHP_ALLOW in /Smarty-2.1.1/Smarty.class.php.
Hope that helps someone out there. Took me forever to figure it out. Now, if someone can tell me how to pass a Smarty-defined variable to an included PHP script, I'd love to hear it!
|