PDA

View Full Version : PHP Question


ZBomber
02-19-2005, 05:47 AM
I've been working on trying to get my website better lately. Since I currently use IFrames, Google and other search engines don't really like it. So I'm starting to change it all to php. My big question: If I'm just adding a few php SSI's, do I need to change all the pages from .html to .php?

Thanks

matt--
02-19-2005, 06:20 AM
What do you mean by php SSIs?

Do you mean that you're includ()ing files via php?
If so , yes, you do have to rename your files to .php.

If you mean that you're using a server side include to include a php document, leave your extensions as .shtml.

ZBomber
02-19-2005, 06:22 AM
Yeh, the first one. This is what I was putting in my site:

<?php require("top.htm"); ?>

RoxStar
02-19-2005, 07:25 AM
SSI (Server Side Includes) Will function if your host supports it (usually if its perl compatible) then you just change your extensions to .shtml .Its really easy for posting news if you have the SSI include news.txt or some other file thats easy to update.

Samuel Dravis
02-19-2005, 11:10 AM
Originally posted by ZBomber
Yeh, the first one. This is what I was putting in my site:

<?php require("top.htm"); ?> You could also do it like this:

<?php include "top.htm";?>

The only real difference is that Require causes a fatal error if something goes wrong; Include just produces a warning.

Joetheeskimo
02-19-2005, 05:27 PM
Originally posted by Samuel Dravis
<?php include "top.htm";?>


Don't you need parantheses like you do for require()? It's a function, after all.

<?php include("top.htm"); ?>

matt--
02-19-2005, 05:49 PM
Originally posted by joetheeskimo5
Don't you need parantheses like you do for require()? It's a function, after all.

<?php include("top.htm"); ?>
Either will work, if I recall correctly. I always include them for good measure.

Also, if you want to surpress warnings and error messages that arise because of the include, you can prefix the command with the @ symbol.
<?php @include("top.htm"); ?>
Now if the file is missing, the user will be none the wiser.

Joetheeskimo
02-19-2005, 05:52 PM
Originally posted by matt--
Either will work, if I recall correctly. I always include them for good measure.

Also, if you want to surpress warnings and error messages that arise because of the include, you can prefix the command with the @ symbol.
<?php @include("top.htm"); ?>
Now if the file is missing, the user will be none the wiser.

I learned to do the same with database queries....does it work for any function?

matt--
02-19-2005, 06:13 PM
Originally posted by joetheeskimo5
I learned to do the same with database queries....does it work for any function?
Yes.

ZBomber
02-19-2005, 06:39 PM
What do you mean fatal error? When I had that and the file name was incorrect, nothing happened....

matt--
02-19-2005, 06:59 PM
It should stop parsing php in the event of a fatal error.