protected function _() { $template = file_get_contents($this->_template); // transform some characters $template = str_replace("\t", str_repeat(" ", 15), $template); $template = str_replace("\n", "<br/>", $template); $tagPattern = "/%([a-z0-9]+)\\:([a-z0-9.]*)\\{*([a-zA-Z0-9:,\\\"']*)\\}*%/"; $tags = array(); preg_match_all($tagPattern, $template, $tags, PREG_SET_ORDER); // PHASE 1 foreach ($tags as $key => $tag) { $content = ''; if ($tag[1] == 'env') { $content = \t41\Core::htmlEncode(\t41\View::getEnvData($tag[2])); unset($tag[$key]); } if (isset($tag[0])) { $template = str_replace($tag[0], $content, $template); } } $this->_document->writeHTML($template); // PHASE 2 - other tags foreach ($tags as $tag) { $content = ''; switch ($tag[1]) { case 'container': $elems = \t41\View::getObjects($tag[2]); if (is_array($elems)) { foreach ($elems as $elem) { $object = $elem[0]; $params = $elem[1]; if (!is_object($object)) { continue; } /* @var $object t41_Form_Abstract */ switch (get_class($object)) { case 't41_Form_List': case 't41_View_Table': case 't41_View_Image': case 't41_View_Component': case 't41_View_Error': case 't41_View_Spacer': $decorator = \t41\View\Decorator::factory($object, $params); $decorator->render($this->_document, $this->_width); break; default: break; } } } break; } } }