July 21, 2005 at 10:51PM The World’s Simplest (decent) PHP Templating Engine...
...is PHP, so why not use it?
function include_view($view, $vars=NULL) { # Start buffering the generated text. ob_start(); # Process the view. if (!is_null($vars)) { extract($vars, EXTR_OVERWRITE | EXTR_REFS); } include("views/$view.php"); # Grab the generated content and clean up. $content = ob_get_contents(); ob_end_clean(); return $content; }
1 On July 22, 2005 at 23:08, Keith Devens wrote:
I do just about the same thing.
2 On July 23, 2005 at 21:03, Keith wrote:
I thought you used Smarty. Good to see you’re not though. I’ve never understood the logic behind using the likes of it.
3 On July 24, 2005 at 19:01, Keith Devens wrote:
Back when I was in my architecture astronaut phase trying to write a web framework I played around with Smarty for a bit trying to fit it into the type of design I wanted. It worked, but required a huge nasty hack. I’m out of my astronaut phase now anyway :)