How to include PHP code inside a Smarty Template
I thought this one will be a doodle to find in google, as many you us UI and script writers would need to do this on a day to day basis, that is include a bit of peice of PHP code snippet(.php) into a Smarty Template (.tpl). I realized that easier/popular your query, even more difficult to find the exact answer… a million search results but most of them reffered to “file” includes in Smarty … which has the following syntax
{include file=”include/header.php”}
This actually inlcuded the file fine but as text , What I wanted was the result of included file .(Note the above is used include template inside a template file). Finally with a bit persiverance …. I stumbled across a slighty modified syntax, which was the answer to my requirement … so here it is… if you havn’t found one already
{include_php file=”include/header.php” }
Subscribe to by Email








































