An Entrepreneur, Coach, IT Consultant, Strategic Adviser, and a Traveler craving to explore and contribute to forming a better society.

Monday, February 23, 2009

Including .PHP Files in Smarty Templates

No comments :
Keywords: Including PHP (.php) Files in Smarty Templates, Including PHP files, PHP files in Smarty Templates

Ever wondered how to insert/import/include php files in smarty templates.

Here is the answer: "{include_php}"

Example:
{include_php file="path/to/file"} /*Normal Inclusion of PHP files in Smarty*/
{include_php file="path/to/file" once} /*Like include_once and require_once*/

To make "include_php" read your file you have add the path of the php file to the "$trusted_dir"

Example:
$smarty->trusted_dir = "/path/to/php/files/directory";

For more information, please visit:-

Keywords: Including PHP (.php) Files in Smarty Templates, Including PHP files, PHP files in Smarty Templates

Featured Blog Topics:

No comments :