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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
camarosource
Forum Commoner
Posts: 77
Joined: Sat Aug 03, 2002 10:43 pm

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

Post 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?
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post 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
Post Reply