Originally Posted by Dormilich
my organisation is relatively simple. I use a front controller pattern, so there is a general script that does the main work. functionality is provided by the appropriate classes (which I load through an autoloader) and HTML is composed by means of a template and echoed out at the end.
Everything of mine goes through one main script - index.php. That includes $_POST submisssions, $_GET requests, everything. That script then does things that would otherwise be replicated in other scripts (thus pointless) like session checking, checking if a user is logged in, checking security permissions, checking site settings etc.
Then the script calls the appropriate module - eg a contact form, picture gallery etc, runs the php code for that, generates the html CONTENT (from smaller templates using file_get_contents() and using str_replace() to put the bits in place of tags) and then puts the finished content into the main template and finally printing it out. Again my main template is full of tags that are replaced such as <title><__title__></title> being for the title of the page.
Thats it really. A template is just that IMO, a template. It should not do anything itself such as content generation or databse lookups, it should simply just hold finished content.