Created
January 23, 2017 12:22
-
-
Save brianteeman/47dbc99ec921036ee4c11e05c4ebf249 to your computer and use it in GitHub Desktop.
Replacement index.php for the Editor template mentioned in http://brian.teeman.net/joomla/867-simplifying-joomla-content-editing-part-1
This file contains hidden or 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 | |
/** | |
* @package Joomla.Site | |
* @subpackage Templates.protostar | |
* | |
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | |
* @license GNU General Public License version 2 or later; see LICENSE.txt | |
*/ | |
defined('_JEXEC') or die; | |
$app = JFactory::getApplication(); | |
$doc = JFactory::getDocument(); | |
$user = JFactory::getUser(); | |
$this->language = $doc->language; | |
$this->direction = $doc->direction; | |
// Output as HTML5 | |
$doc->setHtml5(true); | |
// Getting params from template | |
$params = $app->getTemplate(true)->params; | |
// Detecting Active Variables | |
$option = $app->input->getCmd('option', ''); | |
$view = $app->input->getCmd('view', ''); | |
$layout = $app->input->getCmd('layout', ''); | |
$task = $app->input->getCmd('task', ''); | |
$itemid = $app->input->getCmd('Itemid', ''); | |
$sitename = $app->get('sitename'); | |
if($task == "edit" || $layout == "form" ) | |
{ | |
$fullWidth = 1; | |
} | |
else | |
{ | |
$fullWidth = 0; | |
} | |
// Add JavaScript Frameworks | |
JHtml::_('bootstrap.framework'); | |
$doc->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js'); | |
// Add Stylesheets | |
$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template.css'); | |
// Use of Google Font | |
if ($this->params->get('googleFont')) | |
{ | |
$doc->addStyleSheet('//fonts.googleapis.com/css?family=' . $this->params->get('googleFontName')); | |
$doc->addStyleDeclaration(" | |
h1, h2, h3, h4, h5, h6, .site-title { | |
font-family: '" . str_replace('+', ' ', $this->params->get('googleFontName')) . "', sans-serif; | |
}"); | |
} | |
// Template color | |
if ($this->params->get('templateColor')) | |
{ | |
$doc->addStyleDeclaration(" | |
body.site { | |
border-top: 3px solid " . $this->params->get('templateColor') . "; | |
background-color: " . $this->params->get('templateBackgroundColor') . "; | |
} | |
a { | |
color: " . $this->params->get('templateColor') . "; | |
} | |
.nav-list > .active > a, | |
.nav-list > .active > a:hover, | |
.dropdown-menu li > a:hover, | |
.dropdown-menu .active > a, | |
.dropdown-menu .active > a:hover, | |
.nav-pills > .active > a, | |
.nav-pills > .active > a:hover, | |
.btn-primary { | |
background: " . $this->params->get('templateColor') . "; | |
}"); | |
} | |
// Check for a custom CSS file | |
$userCss = JPATH_SITE . '/templates/' . $this->template . '/css/user.css'; | |
if (file_exists($userCss) && filesize($userCss) > 0) | |
{ | |
$this->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/user.css'); | |
} | |
// Load optional RTL Bootstrap CSS | |
JHtml::_('bootstrap.loadCss', false, $this->direction); | |
// Adjusting content width | |
$span = "span12"; | |
// Logo file or site title param | |
if ($this->params->get('logoFile')) | |
{ | |
$logo = '<img src="' . JUri::root() . $this->params->get('logoFile') . '" alt="' . $sitename . '" />'; | |
} | |
elseif ($this->params->get('sitetitle')) | |
{ | |
$logo = '<span class="site-title" title="' . $sitename . '">' . htmlspecialchars($this->params->get('sitetitle'), ENT_COMPAT, 'UTF-8') . '</span>'; | |
} | |
else | |
{ | |
$logo = '<span class="site-title" title="' . $sitename . '">' . $sitename . '</span>'; | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<jdoc:include type="head" /> | |
<!--[if lt IE 9]><script src="<?php echo JUri::root(true); ?>/media/jui/js/html5.js"></script><![endif]--> | |
</head> | |
<body class="site <?php echo $option | |
. ' view-' . $view | |
. ($layout ? ' layout-' . $layout : ' no-layout') | |
. ($task ? ' task-' . $task : ' no-task') | |
. ($itemid ? ' itemid-' . $itemid : '') | |
. ($params->get('fluidContainer') ? ' fluid' : ''); | |
echo ($this->direction == 'rtl' ? ' rtl' : ''); | |
?>"> | |
<!-- Body --> | |
<div class="body"> | |
<div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>"> | |
<!-- Header --> | |
<header class="header" role="banner"> | |
<div class="header-inner clearfix"> | |
<a class="brand pull-left" href="<?php echo $this->baseurl; ?>/"> | |
<?php echo $logo; ?> | |
<?php if ($this->params->get('sitedescription')) : ?> | |
<?php echo '<div class="site-description">' . htmlspecialchars($this->params->get('sitedescription'), ENT_COMPAT, 'UTF-8') . '</div>'; ?> | |
<?php endif; ?> | |
</a> | |
</div> | |
<a class="btn pull-right btn-info" href="index.php"> | |
<i class="icon-undo"></i> | |
Return to web site </a> | |
</header> | |
<div class="row-fluid"> | |
<main id="content" role="main" class="<?php echo $span; ?>"> | |
<!-- Begin Content --> | |
<jdoc:include type="message" /> | |
<jdoc:include type="component" /> | |
<!-- End Content --> | |
</main> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment