private function _getOutput() { // Make $template and $title accessible in the descendant views $this->__set('template', $this); $this->__set('title', $this->title); // Template View (must run first since ancestor views might call functions from $template) $templateView = XML::text($this->_template->__toString()); // <html> $this->_html = XML::element('html'); $this->_html->dir = $this->dir; if (Kennel::getSetting('i18n', 'enabled')) { $this->_html->lang = i18n::getLang(); } // <head> $this->_head = XML::element('head', $this->_html); // <title> $title = XML::element('title', $this->_head); $title->setValue($this->getTitle()); // favicon if ($this->favicon) { $this->_head->adopt(html::favicon($this->favicon)); } // Content Type $this->_head->adopt(html::meta(array('charset' => 'utf-8'))); // <meta> foreach ($this->_meta as $meta) { $this->_head->adopt(html::meta($meta)); } // <link> foreach ($this->_links as $link) { $this->_head->adopt(html::link($link['rel'], $link['href'], $link['type'], $link['title'])); } // <style> $this->_head->adopt(html::css($this->_stylesheets)); // <script> $this->_head->adopt(html::js($this->_scripts)); // <body> $this->_body = XML::element('body', $this->_html); $this->_body->class = browser::css(); if (Kennel::getSetting('i18n', 'enabled')) { $this->_body->class .= ' ' . i18n::getLang(); } if ($this->bodyClass) { $this->_body->class .= ' ' . $this->bodyClass; } // Inject the Template View $this->_body->adopt($templateView); // Return the whole shebang return self::$DOCTYPE_DECLARATIONS[$this->doctype] . $this->_html->output(true); }
/** * Same as XMLElement::setText, but accepts XMLText nodes as well as * strings * * @param XMLText|string $text * * @return XMLElement returns the element itself */ function setValue($text) { if ($text instanceof XMLText) { $this->adopt($text); } else { XML::text($text, $this); } return $this; }