PDA

View Full Version : Php include in .shtml files?


Andy92
12-07-2006, 06:42 PM
How can i get the php include to work in shtml files?

:confused:

Tyree
12-07-2006, 07:23 PM
You'd have to set the server to parse php within shtml files. You have to be the server administrator to do this, I believe.

You could also just switch the file to .php and use php includes rather than shtml-style includes. Of course, you'd then have to make sure you fixed any links to that page.

marek_mar
12-07-2006, 07:42 PM
include()/require()-ed files are parsed as PHP regardless of extension.

Tyree
12-07-2006, 07:46 PM
Regardless of the server setting? Hmmm, didn't know that. So, I guess we need more info from Mr. Allsortshop in order to diagnose his problem.

marek_mar
12-07-2006, 08:04 PM
They will be parsed as PHP only when they are included/required. If you do that with a *.txt and some user requests that *.txt file directly, the webserver will send the code as if it was text if it's not configured to use PHP with *.txt files.
It's not a very smart thing to let other see the source.

Andy92
12-07-2006, 11:42 PM
Ok,

Could i possibly then make a .shtml file and include that in a php document?

Because i have .shtml documents as my error files like error 404 etc.

And i need to do php includes in the .shtml file.

Or it will work fine if i could include .shtml includes in a .shtml document and also include .shtml files in a .php document.

:confused:

Andy92
12-09-2006, 11:29 PM
Ok,

Got it sorted. Now all my error pages are .php files.

But now, i have ssi includes that were in my shtml files, that look like this...

<!--#echo var="REMOTE_ADDR" -->

etc.

There are not displaying in my php file? How can i get ssi includes to display in a php document?

Or does it have to be shtml?