PDA

View Full Version : SSI and PHP


Pauly
February 17th, 2005, 02:24
Ok here's a tricky one for you all.

I have a .html page, and it will remain .html no possibility of changing it ok? Now, I have a PHP randomizing script and to include the .PHP script I want to use SSI.

The problem with this is, the PHP script doesn't run. I know there's a way to run a script before it's included (Or at least that's what i've been told), but have no clue how. Any ideas?


Note: There is a chance I'll use .htaccess to have the .html extension work as a .php extension, but I would rather run the script then have it included using SSI.

Marble
February 17th, 2005, 06:55
How about the other way around? Use .htaccess to parse .html pages with php and include SSI?

http://ca.php.net/manual/en/function.virtual.php

I'm not too sure about the other way around (the way you suggest...)

Corey Bryant
February 17th, 2005, 12:42
I know that on *NIX, you can tell it to pretend that an HTML file is an SHTML file and that can be parsed before rendering on the browser. Can you also tell the *NIX server to think an HTML file is a PHP file? (I guess something like Marble suggests?)

Marble
February 18th, 2005, 03:06
Using .htaccess:

AddType application/x-httpd-php .php .html

Pauly
February 18th, 2005, 03:28
Yea .htaccess is useful to know :lol: I learnt it when I got bored one day.

Anywho I think I will just make it read as php, thanks guys.

Marble
February 18th, 2005, 09:22
I think its simpler that way =D

But if you are thinking of hiding php then use the .htaccess method. I am considering doing this as a precaution. Between mod_rewrite and parsing .html pages with the php engine it can make sites a bit more "anonymous"...