Forums
This topic is locked
include a php file in a html tagged file ???.html
Posted 15 Feb 2002 15:24:35
1
has voted
15 Feb 2002 15:24:35 david matson posted:
Hi,How do you (or is it possible) to ask a html tagged file (snoopy.html) to include a php file
that reads and embeds cookies and talks to a MySQL database? The code below
(written before the html tag) is not working for me and I really want to avoid changing all
my .html files to .php files.
Thanks for any help,
David
<?
// includes
include("track.php"
?>
<html>
etc...
Replies
Replied 15 Feb 2002 17:15:28
15 Feb 2002 17:15:28 enquest enquest1 replied:
I'm not sure, but I think you have to. However you could I believe say in the PHP.ini or PhP.conf file wich are al the php extensions. However I believe that html is reserved!
Anyway if you change you php.ini or conf first backup it.
Hope this helps
Anyway if you change you php.ini or conf first backup it.
Hope this helps
Replied 15 Feb 2002 17:59:51
15 Feb 2002 17:59:51 chief monkey replied:
If you have complete control over your server you can change the httpd.conf file in Apache so that PHP parses documnets with the .htm extension.
George
Everybody has got to be somewhere
George
Everybody has got to be somewhere
Replied 15 Feb 2002 21:25:41
15 Feb 2002 21:25:41 david matson replied:
Thanks for the replies. My site is located on a remote server only have access to my assigned database and site folder.
Does anyone know of a good traffic tracker (cookie embeder/reader) that works for both .php and .html?
David
Does anyone know of a good traffic tracker (cookie embeder/reader) that works for both .php and .html?
David
Replied 16 Feb 2002 14:30:00
16 Feb 2002 14:30:00 Bruno Mairlot replied:
Unfortunately, for this to work, your server MUST be configured to allow execution in HTML files...
The code you're using to insert the include("track.php" is in itself PHP code..., so if your server does not allow .html files to be executed as PHP files, then, you may do whatever you want, it will never be executed ...
But, you might have another solution ...
Either use the SHTML include tag ... byt using the <--#include or <--#cmd . But, as always, the server must accept includes while reading the file ...
You could also use Javascript trick to encapsulate all of your file into a PHP script that would redirect every request to the right page while tracking the user...But this is not worth the work, because it would be easier for you to change .html to .php files ...
You may consider developping a small script that could change all the .html files to .php files, and then, parsing each .html files to changes the link ...
Hope it helps
Bruno
--- Better to die trying, than never try at all ---
The code you're using to insert the include("track.php" is in itself PHP code..., so if your server does not allow .html files to be executed as PHP files, then, you may do whatever you want, it will never be executed ...
But, you might have another solution ...
Either use the SHTML include tag ... byt using the <--#include or <--#cmd . But, as always, the server must accept includes while reading the file ...
You could also use Javascript trick to encapsulate all of your file into a PHP script that would redirect every request to the right page while tracking the user...But this is not worth the work, because it would be easier for you to change .html to .php files ...
You may consider developping a small script that could change all the .html files to .php files, and then, parsing each .html files to changes the link ...
Hope it helps
Bruno
--- Better to die trying, than never try at all ---
Replied 17 Feb 2002 23:46:50
17 Feb 2002 23:46:50 enquest enquest1 replied:
Just wondering
Would it be possible to have XML script in that would include?
Would it be possible to have XML script in that would include?