rendered paste body<?phpclass Page { var $template; protected $params = array(); function __construct($template, $fill = true) { ob_start(array($this, 'output')); $this->template = file_get_contents($template); if($fill) $this->fillTags(); }/* function __set($tag, $content) { $this->params['<!--$'.$tag.'-->'] = $content; }*/ function __get($tag) { return $this->params['<!--$'.$tag.'-->']; } function output($buffer) { $this->assign('buffer', $buffer); return str_replace(array_keys($this->params), array_values($this->params), $this->template); } function assign($id, $value = null) { if(is_array($id)) foreach($id as $tag => $content) $this->params['<!--$'.$tag.'-->'] = $content; else $this->params['<!--$'.$id.'-->'] = $value; } private function fillTags() { preg_match_all('/<!--\$\w+-->/', $this->template, $a); foreach($a[0] as $tag) $this->params[$tag] = null; }}