Forum Moderators: coopster

Message Too Old, No Replies

Do ssi's work in PHP pages?

Not showing up in my .php pages

         

gms3651

4:07 am on Nov 14, 2006 (gmt 0)

10+ Year Member



Here is my include that works in any .htm page. However, when I change the extension to .php they stop working.

<!--#include virtual="includes/toplinks.htm" -->

Any help would be appreciated.

Thanks.

eelixduppy

4:21 am on Nov 14, 2006 (gmt 0)



Yes, they will work in php files, you just have to set it that way.

Here's the documentation on Configuring your server to permit SSI [httpd.apache.org].

There are multiple methods so reading this yourself is best so that you can decide how you want to go about this.

However all of this seems a little overboard, when you can just use PHP's include function:


[url=http://us3.php.net/manual/en/function.include.php]include[/url]("includes/toplinks.htm");

:)

mcavic

4:26 am on Nov 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree, it should work fine if it's configured properly. It seems silly, though. If you switch entirely to PHP, then you can rid yourself of SSI.

coopster

3:36 pm on Nov 14, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Another "I agree, why use SSI when you have PHP to do the job for you" response from me, but also some resources showing how to do so if the need is still there ...

When parsing SSI's, PHP files don't work [webmasterworld.com]
Parse HTML or not [webmasterworld.com]

NameNick

8:10 pm on Nov 16, 2006 (gmt 0)

10+ Year Member



There is the PHP function virtual()

virtual() is an Apache-specific function which is similar to <!--#include virtual...--> in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header.

NN