Structuring small sites in PHP

Associate
Joined
18 Feb 2008
Posts
1,050
Hi all,

I'm used to writing large sites in asp.net mvc, or PHP with a framework, when it comes to small mostly static sites I'm never quite sure how to approach it.

I've got a small site to do for a friend, it only has 12 pages (6 pages in two different languages), 8 pages are just static content and the other 4 will be update-able (just the text). I feel using ASP.NET MVC, or a PHP framework would be overkill but I still want the code to be easily maintainable and not a complete mess.

In PHP how would you approach doing this? In small projects before I've used things like:

home.php
Code:
<?php
// Connects to MySQL if required, includes other helpers, starts output buffering, etc.
include('includes/generic.php');
?>
......html
<?php
// Show the content of the page inside the main layout 
showPage(ob_get_clean());
?>
It always feels a bit messy to do it like this though because you end up with HTML mixed in with PHP/MySQL all dumped in one file. It gets even worse when certain pages need a different layout than others.

Could anyone describe how they structure things for small sites like this without going overkill and using a framework? Are there any lightweight templating systems that would be suitable for sites like this (not smarty)?

Thanks in advance!
 
I always just use a little php framework which still gives clear urls but is very basic. I wrote some of it myself and it just makes the whole thing easier to manage without giving it too much bloat.
 
Back
Top Bottom