added tpl_classes() function

This commit is contained in:
Anika Henke 2013-08-11 22:19:55 +01:00
parent b93aee0b42
commit 9082afe90a
4 changed files with 25 additions and 7 deletions

View file

@ -30,7 +30,7 @@ header('X-UA-Compatible: IE=edge,chrome=1');
<body>
<!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]-->
<div id="dokuwiki__detail" class="dokuwiki">
<div id="dokuwiki__detail" class="<?php echo tpl_classes(); ?>">
<?php html_msgarea() ?>
<?php if($ERROR){ print $ERROR; }else{ ?>

View file

@ -32,11 +32,10 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
<!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]-->
<?php /* the "dokuwiki__top" id is needed somewhere at the top, because that's where the "back to top" button/link links to */ ?>
<?php /* classes mode_<action> are added to make it possible to e.g. style a page differently if it's in edit mode,
see http://www.dokuwiki.org/devel:action_modes for a list of action modes */ ?>
<?php /* .dokuwiki should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?>
<div id="dokuwiki__site"><div id="dokuwiki__top"
class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($showSidebar) ? 'hasSidebar' : '' ?>">
<?php /* tpl_classes() provides useful CSS classes; if you choose not to use it, the 'dokuwiki' class at least
should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?>
<div id="dokuwiki__site"><div id="dokuwiki__top" class="site <?php echo tpl_classes(); ?> <?php
echo ($showSidebar) ? 'hasSidebar' : ''; ?>">
<?php html_msgarea() /* occasional error and info messages on top of the page */ ?>
<?php tpl_includeFile('header.html') ?>

View file

@ -28,7 +28,7 @@ header('X-UA-Compatible: IE=edge,chrome=1');
<body>
<!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]-->
<div id="media__manager" class="dokuwiki">
<div id="media__manager" class="<?php echo tpl_classes(); ?>">
<?php html_msgarea() ?>
<div id="mediamgr__aside"><div class="pad">
<h1><?php echo hsc($lang['mediaselect'])?></h1>

View file

@ -247,9 +247,28 @@ if (!function_exists('tpl_incdir')) {
/**
* does *not* emulate the core function, but returns only
* if sidebar is set to make it roughly backwards compatible
* (available since Adora Belle)
*/
if (!function_exists('page_findnearest')) {
function page_findnearest($sidebar){
return $sidebar;
}
}
/**
* copied from core (will be available in autumn 2013 release)
*/
if (!function_exists('tpl_classes')) {
function tpl_classes() {
global $ACT, $conf, $ID, $INFO;
$classes = array(
'dokuwiki',
'mode_'.$ACT,
'tpl_'.$conf['template'],
$_SERVER['REMOTE_USER'] ? 'loggedIn' : '',
$INFO['exists'] ? '' : 'notFound',
($ID == $conf['start']) ? 'home' : '',
);
return join(' ', $classes);
}
}