View Full Version : SSI in PHP???
vinceinhiding
08-28-2002, 01:03 AM
for server side includes in an .shtml file, i can do.... but i have no luck doing the same in PHP. How do you do it? So far all i have tried is using the same syntax as a regular .shtml file.
thanks
--joey
don5408
08-28-2002, 08:32 AM
Hi, Joe. The syntax for PHP is a little bit different than with SSI includes in a .shtml file. You don't mention exactly *what* you are looking to include however in case it might help here are two simple examples:
(A) To include a file in a .shtml file you might use something like this:
<!--#include file="header.txt" -->
...to get the same result in PHP you would use something like this:
<?php
include ("header.txt");
?>
(B) To include today's date in the format "Wednesday, August 28, 2002" in a .shtml file you might use something like this:
Today's date is
<!--#config timefmt="%A, %B %d, %Y." -->
<!--#echo var="DATE_LOCAL" -->
...to get the same result in PHP you would use something like this:
Today's date is
<?php
echo( date("l, F dS, Y.") );
?>
Hope that helps!
Don
vinceinhiding
08-28-2002, 12:00 PM
thanks! i was looking for the first example you gave (A), but the second will come in handy. I also just discovered php.net, they have huge online reference manual.
--joey
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.