function parse($layout_template = false) { parent::parse($layout_template); # unpack the props #extract($this->props); # trap the buffer ob_start(); # include the template include $this->template; # get the buffer contents $parsed = ob_get_contents(); # clean the buffer ob_clean(); # if there is a layout if ($this->layout) { # find the type $type = ViewFactory::get_template_type($layout_template); if ($type) { # push the content into the layout $content_for_layout = $parsed; # include the template include $this->layout . ".{$type}"; # get the buffer contents $parsed = ob_get_contents(); } } # close the output buffer ob_end_clean(); # save the result $this->parsed = $parsed; return $parsed; }
function render($controller_name, $layout_template = false) { parent::parse($controller_name, $layout_template); $xsl = new DomDocument(); $xsl->load($this->template); $proc = new xsltprocessor(); $proc->importStyleSheet($xsl); echo $proc->transformToXML($this->props_to_xml()); }