hi,

Is there a way to include a php file in .tpl file.

basically i have a menu (javascript,html and css based) that i want to include in the .tpl file.

thanks

Recommended Answers

All 4 Replies

{php}
// including a php script directly
// from the template.
include("/path/to/display_weather.php");
{/php}

hi,

Is there a way to include a php file in .tpl file.

basically i have a menu (javascript,html and css based) that i want to include in the .tpl file.

thanks

you could add the following to .htaccess -

AddType application/x-httpd-php .tpl

As this will tell php to parse all .tpl files. Then you can include as much php code in those files as you want to.

@muralikalpana:
Actually, that will work if the file is called directly. In the case of Smarty however, this file is opened and parsed, so that won't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.