Hi Nathan, I packaged something like Keri's suggestion into a nice class. Straightforward and much simpler than smarty: http://www.codium.co.nz/microtemplate_php_class/
Matias Gertel Freelance Web Development & Coding e: [email protected] m: +64 21 288 8840 p: +64 9 838 3367 On 5/09/2009, at 11:46 AM, Keri Henare wrote: I sometimes use this very simple templating code: function myTemplate($template, $variables = array()) { extract($variables); ob_start(); include(TEMPLATE_LOCATION.'/'.$template.'.template.php'); return ob_get_clean(); } Then you do something like: <?php echo myTemplate('header', array('pageTitle' => 'about us')); ?> <p> Content here! </p> HTH Kind regards, --------------------------------------------------- Keri Henare (Views expressed are not necessarily those of my employer.) [e] [email protected] [m] 021 874 552 [w] www.kerihenare.com On 2/09/2009, at 11:36 AM, Nathan Cox wrote: > Does anyone here know of any good simple PHP templating frameworks? > I get given sites to update/extend/maintain that are just made of > alot of static HTML and I'm not a fan of having to go through every > page to make one change, but the clients are sure they don't want a > CMS. So I want to find some kind of simple framework for these > kinds of sites that can handle site-wide templates but also make it > easy to set page titles, current menu items, page-specific CSS/JS etc. > > I know I can just do > > $pageTitle = 'about us'; > include('includes/header.php'); > <p> > Content here! > </p> > > but it can get messy with nested subpages and whatnot so I was if > there's something somewhere between this and a CMS..? > > > Nathan > >> --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
