Created
January 25, 2013 14:00
-
-
Save proweb/4634662 to your computer and use it in GitHub Desktop.
HTML 5 Joomla head override - Переписываем вывод HEAD для Joomla 2.5 в соответствии со стандартами HTML5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// no direct access | |
defined('_JEXEC') or die; | |
// Variables | |
$doc = JFactory::getDocument(); | |
$user = JFactory::getUser(); | |
$template = 'templates/' . $this->template; | |
// get html head data | |
$head = $doc->getHeadData(); | |
// remove deprecated meta-data (html5) | |
unset($head['metaTags']['http-equiv']); | |
unset($head['metaTags']['standard']['title']); | |
unset($head['metaTags']['standard']['rights']); | |
unset($head['metaTags']['standard']['language']); | |
// Robots if you wish | |
//unset($head['metaTags']['standard']['robots']); | |
if($user->guest){ | |
// Mootools remove for unregistered | |
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-core.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-more.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/core.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/caption.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/modal.js']); | |
} | |
$doc->setHeadData($head); | |
// New meta | |
$doc->setMetadata('X-UA-Compatible', 'IE=edge,chrome=1'); | |
$doc->setMetadata('viewport', 'width=device-width, initial-scale=1.0'); | |
// Copyrights | |
$doc->setMetadata('Author', 'Серега Мочалов'); | |
$doc->setMetadata('copyright', htmlspecialchars($app->getCfg('sitename'))); | |
//Yandex and Google Webmaster-tools if you wish | |
//$doc->setMetadata('yandex-verification', 'xxxxxxxxxxxxxxxx'); | |
//$doc->setMetadata('google-verification', 'xxxxxxxxxxxxxxxx'); | |
//Remove or rewrite ($doc->setGenerator('your generator');) | |
$doc->setGenerator(''); | |
//Add your styles | |
$doc->addStyleSheet($this->baseurl. '/templates/system/css/system.css'); | |
$doc->addStyleSheet($this->baseurl. '/templates/system/css/general.css'); | |
$doc->addStyleSheet($template.'/css/joomla.css'); | |
$doc->addStyleSheet($template.'/css/template.css'); | |
$doc->addStyleSheet($template.'/css/theme1.css'); | |
?> | |
<!DOCTYPE HTML> | |
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>"> | |
<head> | |
<meta charset="utf-8" /> | |
<jdoc:include type="head" /> | |
</head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
unset($this->_metaTags); joomla 3.7 == unset($head['metaTags']['http-equiv']);