PDA

View Full Version : PHP or HTML?


darryls
05-24-2001, 07:13 PM
Hello people. I've been following these threads for a while now and am just about ready to get an account. I have a question though. I have a Linux box here at my house and I have pretty much designed my web site and am ready to put it up. I designed it using PHP to generate the pages, using PHP to generate the "header code" and "footer code" so each page has the same basic layout. When you go to a page, it loads the header and then grabs the appropriate text and then loads the footer.

My question is should I save the pages as straight HTML or upload the PHP and have the pages generated dynamically? 95% of the pages on the site are static, and I basically used PHP for ease of adding pages so I wouldn't have to look at the HTML while writing content. It's no problem saving the pages as HTML since I have a Perl script that can grab pages from my Linux box and save them, so I was wondering if there was any advantage in doing this. I really don't care which way I upload since I work on the pages here at home. Thanks.

Darryl

Terra
05-24-2001, 08:55 PM
PHP is perfectly designed to do template inclusions...[nbsp][nbsp]SSI is more optimal and lighter weight to perform this, but with PHP the overhead in this respect is negligible...

I will always encourage people to use includes as much as possible because that is why PHP and SSI are made available...

--
Terra
--Write once - Use many--
FutureQuest

<EDIT: is != plural>

[This message has been edited by ccTech (edited 05-24-01@7:56 pm)]

PaulKroll
05-25-2001, 02:11 AM
If you're going to change your site templates often, or if you see going to a more session-driven, customized site at some point in the future, there may be advantages to going with PHP pages right now.

On the other hand, apache can serve straight HTML so fast it's ludicrous... AND, if you're using PHP, some of the stuff that's almost automatic with HTML serving (like last-modified dates and easily added Expires times) is more coding work. 15% of the site traffic to my employer's site on FQ is 304s: this saves a LOT of bandwidth. (That's counting graphics too, of course, but our home page changes daily, and we set a default Expires of 1 hour as we're being rather conservative... we could probably make that a LOT longer for most directories...)

I'd suggest going w/plain HTML pages until you feel you're going to need to go full dynamic. Mind, we've built ourselves a set of tools (OK, OK, a few Perl and bash scripts) to move masses of pages over if we have to do a template change to the static critters. (For the 2300 or so static pages, it'd end up being about 8 minutes work to replace them all and have them up on FQ.)

Lastly, if your script pulls pages and saves them, but they still have a &quot;.php&quot; extension, all the happy automatic last modified and easily-set-up expires, won't work, because Apache will still see it as a &quot;dynamic&quot; page. This might be an issue if all your links are already ending in &quot;.php&quot;. :)