I’m close to completing a library that lets you create multiple master-templates filled with regions (or yields, have you). Then, within your controllers, you simply write to those regions. Regions are defined before hand, so your master templates don’t get cluttered with a bunch of conditional routines for each region. You can go a step beyond just defining a region and define default content and markup (xhtml and attributes).
Snippet of a master template
<h1><?= $title ?></h1>
<div id="content">
<?= $content ?>
</div>
Filling regions from the controller (ideally a controller, but could happen anywhere)
$this->template->write($title, 'title'); // Writes $title to the 'title' region
$this->template->write($intro, 'content'); // Writes $intro to 'content' region
$this->template->write_view('article', $article, 'content'); // Loads $article to the 'article.php' view and appends the rendered view to the 'content' region ($intro remains)
Also possible, but not as likely useful (or recommended)
$name = 'Colin';
$this->template->write($name, 'content', '<div>', array('class' => 'name'));
/* Written to 'content' region:
<div class="name">Colin</div>
*/
Then the output
$this->template->output('template'); // Loads and displays template.php (in the 'views' folder
or, more simply
$this->template->output(); // Loads and displays master template already set in config
The ability to override the master template on this call any time makes the front-end coding much easier, especially if you have drastically different layouts for different areas of a site.
Theres some other goodies I’m going to add before I release it (mainly message handling, where messages persist across internal redirects). I’ve used it on a few projects now and have enjoyed it.