It seems like everyone these days is using some sort of CMS. Is there any reason to code the pages by hand anymore for a frequently updated site? One of the few upsides I can see is the speedier load time of non-cms sites because of the lack of need for a database interaction but other than that I can't think of much else. <p>Anyone out there not using some sort of CMS for a site of reasonable complexity?
For really simple sites that don't need a full blown database backed CMS I just use simple PHP includes like the following:<p><pre><code> <?php
$title = "Whatever";
include("header.php");
include("content.txt"); // or just include the content inline
include("footer.php");
?>
</code></pre>
Then header.php is just:<p><pre><code> <html>
<head>
<title>My Site - <?php echo $title; ?></title>
<!-- other header stuff like css, scripts, etc -->
</head>
<body>
<div id="content">
</code></pre>
and footer.php is just:<p><pre><code> </div>
<!-- other footer stuff like Google Analytics, etc -->
</body>
</html>
</code></pre>
If you want to get a little fancier you can set up a URL rewriting (like Apache's mod_rewrite) to internally change yoursite.com/section/subsection to yoursite.com/content.php?a=section&b=subection or something, then you can eliminate all the duplicate templates and just have your content files (<i>make sure you validate the section and subsection names</i>). Or you could plug in a really simple database.<p>I'm no PHP expert, so if anyone has better ways of doing this kind of thing I'd love to hear it.<p>(actually, I have a question: with this layout it's hard to pass data from included files back up to the templates, like $title above needs to be defined before the header include... is there some trick I'm missing?)
"Is there any reason to code the pages by hand anymore for a frequently updated site?"<p>There hasn't been a reason to hand code anything that is at all dynamic or frequently updated for a decade. There's a reason PHP is so popular after all.<p>That being said, any HTML/CSS that has to do with layout is still best done by hand. <p>On the spectrum of tools available, what most people are looking for is a hand-coded layout/template with something like wordpress/moveable type generating the content.
I used to do a simple rails site for anything I put on the web. I switch to html based site for things that I wasn't updating much. The reason was to save on memory usage on my vps.<p>For a site of any complexity, I would use a cms, home-brewed or open-sourced though. <p>Removing the database layer is always a nice option, but if you plan to have any sort of interactivity, straight html might be a pain.