Page 1 of 1

Is there a way of INCLUDING (calling) php from a .TPL file??

Posted: Mon Jan 03, 2005 8:53 pm
by camarosource
I have a users online php file that I call (INCLUDE) from my main php menu but would also like to be able to track the people who go on my PHPBB forum, or links or product reviews database that run on .TPL (html) files.

The PHPbb forum executes from a .php file but is not just an htm file renamed to php rather it's an actual php script that executes the forum. And my review/links database program runs each from a seperate index.php and they too are scripts and not htm

From for main layout of the website I can use

Code: Select all

<?
include("http://www.camarosource.ca/useronline.php");
?>
since it's a HTM file renamed to php. But how can I do this for my other programs?

Posted: Mon Jan 03, 2005 9:04 pm
by rehfeld
if you include the file directly, instead of requesting it via a url like you did above, php will parse whatever is in the file

for example

Code: Select all

include 'foo.txt';
if there is php code w/ valid <?php tags in foo.txt, php WILL parse it even though the file ext is not .php. include does not care what the file ext is. it will be parsed as php no matter what.


if you want it so that the file will be parsed as php even if requested from a url, you can add this to your htaccess

Code: Select all

AddType application/x-httpd-php .TPL
now apache will have php parse all TPL files