Click to See Complete Forum and Search --> : Add a line of php to a html page


mr_bill
04-15-2005, 04:49 PM
Would anyone know of a way to add

<?php if (ZEN_CONFIG_USER_TRACKING == 'true') { zen_update_user_tracking(); } ?>

to an html page? I am running a site using php but the home page is html and this would be the line of cade that would be inputted into the footer.php files to track users. Since I have an html it is not using the footer.php

felgall
04-15-2005, 05:34 PM
If you are running on an Apache web server then adding the following line to your .htaccess file then all .html files will be able to include PHP.

AddType application/x-httpd-php .html

This will slightly slow the display of any other .html pages since they will all be checked for any PHP code that they might contain before delivery.

Ben Rogers
04-15-2005, 06:34 PM
Why not just change it to a PHP file, and then use PHP normally? You could save HTML files as PHP, and it wouldn't make a noticeable difference, assuming you're not using XML...

leocharre
04-15-2005, 08:34 PM
Here's another cool thing.
Make it an .shtml file. And include to a php file. You can even pass it a query string to get different outputs.
<!--#include virtual="/path2php/this.php?var1=that"-->