diff options
author | Anika Henke <anika@selfthinker.org> | 2013-07-21 21:20:44 +0100 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2013-07-21 21:20:44 +0100 |
commit | c71db656795e82055d114764ad93f71a968a2f28 (patch) | |
tree | aa42f8372326f3248cc5caf986d0197307174c95 | |
parent | 8c7670b52dc523860f442a628ae7d226988e96d7 (diff) | |
download | rpg-c71db656795e82055d114764ad93f71a968a2f28.tar.gz rpg-c71db656795e82055d114764ad93f71a968a2f28.tar.bz2 |
added tpl_classes() to return useful layout classes
-rw-r--r-- | inc/template.php | 18 | ||||
-rw-r--r-- | lib/tpl/dokuwiki/detail.php | 4 | ||||
-rw-r--r-- | lib/tpl/dokuwiki/main.php | 5 |
3 files changed, 22 insertions, 5 deletions
diff --git a/inc/template.php b/inc/template.php index a87650b84..087e2f9df 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1748,5 +1748,23 @@ function tpl_media() { echo '</div>'.NL; } +/** + * Return useful layout classes + * + * @author Anika Henke <anika@selfthinker.org> + */ +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); +} + //Setup VIM: ex: et ts=4 : diff --git a/lib/tpl/dokuwiki/detail.php b/lib/tpl/dokuwiki/detail.php index 9108504f1..c44a697dd 100644 --- a/lib/tpl/dokuwiki/detail.php +++ b/lib/tpl/dokuwiki/detail.php @@ -28,8 +28,8 @@ 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__site"><div id="dokuwiki__top" - class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($_SERVER['REMOTE_USER']) ? 'loggedIn' : '' ?>"> + <div id="dokuwiki__site"><div id="dokuwiki__top" class="site <?php echo tpl_classes(); ?> <?php + echo ($showSidebar) ? 'showSidebar' : ''; ?> <?php echo ($hasSidebar) ? 'hasSidebar' : ''; ?>"> <?php include('tpl_header.php') ?> diff --git a/lib/tpl/dokuwiki/main.php b/lib/tpl/dokuwiki/main.php index d432a701e..016146275 100644 --- a/lib/tpl/dokuwiki/main.php +++ b/lib/tpl/dokuwiki/main.php @@ -27,9 +27,8 @@ $showSidebar = $hasSidebar && ($ACT=='show'); <body> <!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]--> - <div id="dokuwiki__site"><div id="dokuwiki__top" - class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($showSidebar) ? 'showSidebar' : ''; - ?> <?php echo ($hasSidebar) ? 'hasSidebar' : ''; ?> <?php echo ($_SERVER['REMOTE_USER']) ? 'loggedIn' : '' ?>"> + <div id="dokuwiki__site"><div id="dokuwiki__top" class="site <?php echo tpl_classes(); ?> <?php + echo ($showSidebar) ? 'showSidebar' : ''; ?> <?php echo ($hasSidebar) ? 'hasSidebar' : ''; ?>"> <?php include('tpl_header.php') ?> |