Simplest possible PHP templating engine
// and parses them with a file
//
// Example:
// print template('hello', array('who'=>'world'));
//
// Template (/templates/hello.html)
// Hello <?=$who?>!
//
// Outputs:
// Hello world!
1 2 define('DIR_TEMPLATES', dirname(__FILE__).'/templates'); 3 4 function template($__name__, $__data__=array()) { 5 extract($__data__); 6 ob_start(); 7 require(DIR_TEMPLATES.'/'.$__name__.'.html'); 8 return ob_get_clean(); 9 }