Forum Moderators: coopster

Message Too Old, No Replies

Can I use PHP instead of SSI for includes?

         

Marcia

1:57 am on Apr 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How much of a transition is it to use PHP to include sections of web pages (or whole pages) rather than using SSI?

I've put this in .htaccess already:

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

Is it any more difficult or involved?

Birdman

2:49 am on Apr 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Marcia,

I have a site that is all .html extensions and uses PHP. This is the line I have in .htaccess:

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

It's pretty simple to include at this point by using:

<?php
include("file.php");
?>

I decided to just switch to straight .php on my best site and it went over without a hitch. Of course, I set up redirects when I did it.

jatar_k

3:32 am on Apr 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



all you would have to do is switch all of your SSI include virtual (or whichever) to <? include [php.net] "somefile.php";?>. Not difficult but can be time consuming depending on the number of includes to replace.

I assume there is an ulterior motive such as using more php than just includes to make it more than a make work project.

Marcia in php, I had to rub my eyes and pinch myself, she's coming over to the dark side ;)

Birdman

12:07 pm on Apr 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jatar_k, I've never seen it done without parens surrounding the filename.

Would you mind explaining that? I'm assuming because it's only a one-liner but it still seems wierd.

Thanks!

jatar_k

4:13 pm on Apr 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if you take a look at the documentation the examples don't have parens.

[php.net...]

include 'vars.php';

One of those silly things, I have never used parens and when I work on someone's code I usually remove them. A pet peeve. ;)