Forum Moderators: coopster

Message Too Old, No Replies

PHP vs. SSI

What's the difference?

         

dougmcc1

2:32 am on Jul 9, 2003 (gmt 0)

10+ Year Member



Is there a difference in using servide side includes versus PHP includes? Ex:

<? include 'includes.php';?>
<!--#include file='includes.php' -->

lorax

2:37 am on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yup.

SSI is simply added to the HTML.

PHP includes are parsed and then added so you can use them to execute functions, create classes, or do other stuff as needed.

dougmcc1

2:45 am on Jul 9, 2003 (gmt 0)

10+ Year Member



So when would one use SSI in lieu of PHP includes?

lorax

12:42 pm on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's a big question.

It really depends upon what you're trying to accomplish and what you want to accomplish in the future. If all you're trying to do is streamline your site maintenance by reusing common code (i.e. a single file for common navigation or header, etc.) then I'd suggest you use SSI.

I tend to use PHP includes only if:
A. my files are already in PHP
B. I need to preprocess something and use the result
C. I want to be sure the include file is included (require) or else stop where you are

HTH

bilalak

8:55 am on Jul 10, 2003 (gmt 0)

10+ Year Member



I do not suggest SSI unless there is no PHP equivalent or it is not secure to include others code in the main PHP script.

dougmcc1

1:08 pm on Jul 10, 2003 (gmt 0)

10+ Year Member



Can you give an example when it wouldn't be secure to use a PHP include?