public function render() { $html = ''; foreach ($this as $key => $value) { $html .= html::meta($key, $value); } return $html; }
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); }
public function header() { $header = $this->render('header'); if (!$header) { $javascript = (array) $this->js; $css = (array) $this->css; $metas = (array) $this->meta; $html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $html[] = '<html xmlns="http://www.w3.org/1999/xhtml">'; $html[] = '<head>'; $html[] = ' <title>' . $this->title . ' ' . zotop::config("zotop.title") . '</title>'; $html[] = ' ' . html::meta('keywords', $this->keywords . ' ' . zotop::config("zotop.keywords")); $html[] = ' ' . html::meta('description', $this->description . ' ' . zotop::config("zotop.description")); $html[] = ' ' . html::meta('Content-Type', 'text/html;charset=utf-8'); $html[] = ' ' . html::meta('X-UA-Compatible', 'IE=EmulateIE7'); foreach ($metas as $meta) { $html[] = ' ' . html::meta($meta); } $html[] = ' ' . html::stylesheet('$theme/css/zotop.css', array('id' => 'zotop')); $html[] = ' ' . html::stylesheet('$theme/css/global.css', array('id' => 'global')); foreach ($css as $stylesheet) { $html[] = ' ' . html::stylesheet($stylesheet); } $html[] = ' ' . html::script('$common/js/jquery.js', array('id' => 'jquery')); $html[] = ' ' . html::script('$common/js/jquery.plugins.js', array('id' => 'plugins')); $html[] = ' ' . html::script('$common/js/zotop.js', array('id' => 'zotop')); $html[] = ' ' . html::script('$common/js/global.js', array('id' => 'global')); foreach ($javascript as $js) { $html[] = ' ' . html::script($js); } $html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon')); $html[] = '</head>'; $html[] = '<body' . html::attributes($this->body) . '>'; $html[] = '<div id="wrapper">'; $html[] = '<div id="page">'; $html[] = ''; $header = implode("\n", $html); } echo $header; }
public function header() { $html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $html[] = '<html xmlns="http://www.w3.org/1999/xhtml">'; $html[] = '<head>'; $html[] = ' <title>' . $this->title . ' ' . zotop::config("zotop.title") . '</title>'; $html[] = ' ' . html::meta('keywords', $this->keywords); $html[] = ' ' . html::meta('description', $this->description); $html[] = ' ' . html::meta('Content-Type', 'text/html;charset=utf-8'); $html[] = ' ' . html::meta('X-UA-Compatible', 'IE=EmulateIE7'); $html[] = ' ' . html::stylesheet(ZOTOP_APP_URL_CSS . '/zotop.css', array('id' => 'zotop')); $html[] = ' ' . html::stylesheet(ZOTOP_APP_URL_CSS . '/global.css', array('id' => 'global')); $html[] = ' ' . html::link(ZOTOP_APP_URL_IMAGE . '/fav.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link(ZOTOP_APP_URL_IMAGE . '/fav.ico', array('rel' => 'icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link(ZOTOP_APP_URL_IMAGE . '/fav.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon')); $html[] = '</head>'; $html[] = '<body' . html::attributes($this->body) . '>'; $str = implode("\n", $html); echo $str; }
public function header() { $javascript = (array) $this->js; $css = (array) $this->css; $metas = (array) $this->meta; $html[] = '<!DOCTYPE html>'; $html[] = '<html>'; $html[] = '<head>'; $html[] = ' <title>' . $this->title . ' ' . zotop::config("zotop.title") . '</title>'; $html[] = ' ' . html::meta('keywords', $this->keywords . ' ' . zotop::config("zotop.keywords")); $html[] = ' ' . html::meta('description', $this->description . ' ' . zotop::config("zotop.description")); $html[] = ' ' . html::meta('Content-Type', 'text/html;charset=utf-8'); $html[] = ' ' . html::meta('X-UA-Compatible', 'IE=EmulateIE7'); foreach ($metas as $meta) { $html[] = ' ' . html::meta($meta); } $html[] = ' ' . html::stylesheet('$theme/css/zotop.css', array('id' => 'zotop')); $html[] = ' ' . html::stylesheet('$theme/css/global.css', array('id' => 'global')); foreach ($css as $stylesheet) { $html[] = ' ' . html::stylesheet($stylesheet); } $html[] = ' ' . html::script('$common/js/jquery.js', array('id' => 'jquery')); $html[] = ' ' . html::script('$common/js/jquery.plugins.js', array('id' => 'plugins')); $html[] = ' ' . html::script('$common/js/zotop.js', array('id' => 'zotop')); $html[] = ' ' . html::script('$common/js/global.js', array('id' => 'global')); foreach ($javascript as $js) { $html[] = ' ' . html::script($js); } $html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon')); $html[] = '</head>'; $html[] = '<body' . html::attributes($this->body) . '>'; $html[] = '<div id="wrapper">'; $html[] = '<div id="container" class="clearfix">'; $html[] = ''; echo implode("\n", $html); }
<?php if (!isset($title)) { $title = ''; } if (!empty($title)) { $title .= $lang->minus; } if (!isset($keywords)) { $keywords = $config->site->keywords; } if (!isset($desc)) { $desc = $config->site->desc; } echo html::title($title . $config->site->name); echo html::meta('keywords', strip_tags($keywords)); echo html::meta('description', strip_tags($desc)); if (isset($this->config->site->meta)) { echo $this->config->site->meta; } css::import($webRoot . 'zui/css/min.css'); css::import($themeRoot . 'common/style.css'); css::import($jsRoot . 'jquery/treeview/min.css'); /* Import customed css file if it exists. */ $siteCustomCssFile = $this->app->getDataRoot() . 'css' . DS . $this->config->site->code . DS . $this->config->template->{$this->device}->name . DS . $this->config->template->{$this->device}->theme . DS . 'style.css'; if ($this->config->multi && file_exists($siteCustomCssFile)) { css::import(sprintf($webRoot . 'data/css/%s/%s/%s/style.css?' . $this->config->template->customVersion, $config->site->code, $config->template->{$this->device}->name, $config->template->{$this->device}->theme)); } else { $customCssFile = $this->app->getDataRoot() . 'css' . DS . $this->config->template->{$this->device}->name . DS . $this->config->template->{$this->device}->theme . DS . 'style.css'; if (file_exists($customCssFile)) { css::import(sprintf($webRoot . 'data/css/%s/%s/style.css?' . $this->config->template->customVersion, $config->template->{$this->device}->name, $config->template->{$this->device}->theme)); }
public static function meta($tag, $value = '') { $str = ''; if (is_array($tag)) { foreach ($tag as $attr => $value) { $str .= html::meta($attr, $value) . "\n"; } } else { $attr = in_array(strtolower($tag), array('content-type', 'content-language', strtolower('X-UA-Compatible'))) ? 'http-equiv' : 'name'; $str = '<meta ' . $attr . '="' . $tag . '" content="' . $value . '" />'; } return $str; }
/** * Creates a meta tag. * * @param string|array tag name, or an array of tags * @param string tag "content" value * @return string */ public static function meta($tag, $value = NULL) { if (is_array($tag)) { $tags = array(); foreach ($tag as $t => $v) { // Build each tag and add it to the array $tags[] = html::meta($t, $v); } // Return all of the tags as a string return implode("\n", $tags); } // Set the meta attribute value $attr = in_array(strtolower($tag), Kohana::config('http.meta_equiv')) ? 'http-equiv' : 'name'; return '<meta ' . $attr . '="' . $tag . '" content="' . $value . '" />'; }
public static function meta($metas) { //默认的meta $default = array('keywords' => 'zotop cms', 'description' => 'simple,beautiful', 'Content-Type' => 'text/html;charset=utf-8', 'X-UA-Compatible' => 'IE=EmulateIE7'); //用户的meta $metas = array_merge($default, (array) $metas); foreach ($metas as $name => $value) { $html[] = ' ' . html::meta($name, $value) . ''; } return implode("\n", $html); }
<?php $webRoot = $this->app->getWebRoot(); $jsRoot = $webRoot . 'js/'; ?> <!DOCTYPE html> <html lang='en'> <head> <?php if (isset($title)) { echo html::title($title); } echo html::meta('charset', 'utf-8'); echo html::meta('viewport', 'width=device-width, initial-scale=1.0'); css::import($webRoot . 'theme/bootstrap/css/bootstrap.min.css'); css::import($webRoot . 'theme/my.css'); css::import($webRoot . 'theme/bootstrap/css/bootstrap-responsive.min.css'); if (isset($pageCss)) { css::internal($pageCss); } js::import($jsRoot . 'jquery.min.js', $config->version); js::import($jsRoot . 'bootstrap.min.js', $config->version); js::import($jsRoot . 'html5shiv.min.js', $config->version, 'lt IE 9'); js::import($jsRoot . 'my.js', $config->version); js::exportConfigVars(); echo html::icon($webRoot . 'favicon.ico'); ?> </head> <body><div id='main'> <?php include dirname(__FILE__) . '/nav.html.php';