/** * Return the starting HTML for the page * * Note: When displaying a View directly from user code (not a conroller), * it does not automatically create the HTML <html>, <body> and * <head> tags. This code fixes that. * * There is probably a better way to do this! */ protected function startHTML() { jimport('joomla.filesystem.file'); require_once JPATH_BASE . '/libraries/joomla/document/html/renderer/head.php'; $document = JFactory::getDocument(); $this->assignRef('document', $document); $app = JFactory::getApplication(); $this->template = $app->getTemplate(true)->template; $template_dir = $this->baseurl . '/templates/' . $this->template; $file = '/templates/system/css/system.css'; if (JFile::exists(JPATH_SITE . $file)) { $document->addStyleSheet($this->baseurl . $file); } // Try to add the typical template stylesheets $files = array('template.css', 'position.css', 'layout.css', 'general.css'); foreach ($files as $file) { $path = JPATH_SITE . '/templates/' . $this->template . '/css/' . $file; if (JFile::exists($path)) { $document->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/' . $file); } } // Add the CSS for the attachments list (whether we need it or not) JHtml::stylesheet('com_attachments/attachments_list.css', array(), true); $head_renderer = new JDocumentRendererHead($document); $html = ''; $html .= "<html>\n"; $html .= "<head>\n"; $html .= $head_renderer->fetchHead($document); $html .= "</head>\n"; $html .= "<body id=\"attachments_iframe\">\n"; return $html; }
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later */ defined('_JEXEC') or die; $this->helix = Helix::getInstance(); if (!isset($this->error)) { $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); $this->debug = false; } //get language and direction $doc = JFactory::getDocument(); $this->language = $doc->language; $this->direction = $doc->direction; $this->helix->getDocument()->setTitle($this->error->getCode() . ' - ' . $this->title); $this->helix->header()->addLess('error', 'error'); require_once JPATH_LIBRARIES . '/joomla/document/html/renderer/head.php'; $header_renderer = new JDocumentRendererHead($doc); $header_contents = $header_renderer->render(null); ?> <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="<?php echo $this->language; ?> "> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="<?php echo $this->language; ?> "> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="<?php echo $this->language; ?> "> <![endif]-->
public static function renderPage($content = "") { include_once "head.php"; $document = JFactory::getDocument(); $rendererHead = new JDocumentRendererHead($document); ?> <html> <head> <?php echo $rendererHead->fetchHead($document); ?> </head> <body> <?php echo $content; ?> </body> </html> <?php }