initlal commit
This commit is contained in:
parent
bc61010c4d
commit
632096984c
14
README.md
14
README.md
|
@ -1,2 +1,14 @@
|
|||
# dokuwiki-template-base
|
||||
Basic template for Dokuwiki with clean, semantic HTML
|
||||
|
||||
Basic template for Dokuwiki with clean, semantically sensible markup.
|
||||
|
||||
Made for my own use, as a starting point for Dokuwiki templates, but I hope you find it useful!
|
||||
|
||||
xx Rylie
|
||||
|
||||
## Usage
|
||||
|
||||
* `Clone` (put) this project into your wiki's template directory at `lib/tpl/`,
|
||||
* or: grab a compressed packge from [the releases page](https://github.com/ryliejamesthomas/dokuwiki-template-base`) and extract it into `lib/tpl/`. This'll be smaller 'cause it's free of a bunch of the Git cruft.
|
||||
|
||||
NB: You can add styles independantly of themes too, at `conf/userall.css`
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
a.wikilink1 {
|
||||
color:blue;
|
||||
}
|
||||
|
||||
a.wikilink1:visited {
|
||||
color:darkblue;
|
||||
}
|
||||
|
||||
a.wikilink2 {
|
||||
color:red;
|
||||
text-decoration:underline dashed red;
|
||||
}
|
||||
|
||||
body > footer,
|
||||
body > header,
|
||||
body > main,
|
||||
body > nav {
|
||||
border:1px red dotted;
|
||||
margin:1em;
|
||||
padding:1em;
|
||||
}
|
||||
|
||||
body > footer {
|
||||
max-height:3em;
|
||||
}
|
||||
|
||||
body > footer > section > ul,
|
||||
body > header > section > ul {
|
||||
list-style-type:none;
|
||||
padding-left:0;
|
||||
}
|
||||
|
||||
body > footer > section > ul > li,
|
||||
body > header > section > ul > li {
|
||||
display:inline-block;
|
||||
margin-left:1em;
|
||||
}
|
||||
|
||||
body > footer > section > ul > li:first-child,
|
||||
body > header > section > ul > li:first-child {
|
||||
margin-left:0;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
body {
|
||||
display:grid;
|
||||
grid-template-columns:__sidebar_width__ __site_width__;
|
||||
grid-template-areas:
|
||||
"header header"
|
||||
"sidebar main"
|
||||
"sidebar footer";
|
||||
}
|
||||
|
||||
body > footer {
|
||||
grid-area:footer;
|
||||
}
|
||||
|
||||
body > header {
|
||||
grid-area:header;
|
||||
}
|
||||
|
||||
body > nav {
|
||||
grid-area:sidebar;
|
||||
}
|
||||
|
||||
main {
|
||||
grid-area:main;
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
if (!defined('DOKU_INC')) die();
|
||||
@require_once(dirname(__FILE__).'/tpl_functions.php');
|
||||
header('X-UA-Compatible: IE=edge,chrome=1');
|
||||
|
||||
$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) );
|
||||
$showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
|
||||
?><!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>" lang="<?php echo $conf['lang'] ?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
|
||||
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
|
||||
<?php tpl_metaheaders() ?>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<?php echo tpl_favicon(array('favicon', 'mobile')) ?>
|
||||
<?php tpl_includeFile('meta.html') ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<?php html_msgarea() ?>
|
||||
<?php tpl_includeFile('header.html') ?>
|
||||
<h1><?php tpl_link(wl(),$conf['title'],'accesskey="h" title="[H]"') ?></h1>
|
||||
<?php if ($conf['tagline']): ?>
|
||||
<p><?php echo $conf['tagline'] ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($conf['useacl'] && $showTools): ?>
|
||||
<section>
|
||||
<h3 class="a11y"><?php echo $lang['user_tools'] ?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
if (!empty($_SERVER['REMOTE_USER'])) {
|
||||
echo '<li class="user">';
|
||||
tpl_userinfo(); /* 'Logged in as ...' */
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
<?php /* the optional second parameter of tpl_action() switches between a link and a button,
|
||||
e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */
|
||||
?>
|
||||
<?php tpl_toolsevent('usertools', array(
|
||||
'admin' => tpl_action('admin', 1, 'li', 1),
|
||||
'userpage' => _tpl_action('userpage', 1, 'li', 1),
|
||||
'profile' => tpl_action('profile', 1, 'li', 1),
|
||||
'register' => tpl_action('register', 1, 'li', 1),
|
||||
'login' => tpl_action('login', 1, 'li', 1),
|
||||
)); ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
<section>
|
||||
<ul>
|
||||
<?php tpl_toolsevent('sitetools', array(
|
||||
'recent' => tpl_action('recent', 1, 'li', 1),
|
||||
'media' => tpl_action('media', 1, 'li', 1),
|
||||
'index' => tpl_action('index', 1, 'li', 1),
|
||||
)); ?>
|
||||
</ul>
|
||||
</section>
|
||||
<nav>
|
||||
<?php tpl_searchform() ?>
|
||||
<?php if($conf['breadcrumbs']){ ?>
|
||||
<section class="breadcrumbs"><?php tpl_breadcrumbs() ?></section>
|
||||
<?php } ?>
|
||||
<?php if($conf['youarehere']){ ?>
|
||||
<section class="youarehere"><?php tpl_youarehere() ?></section>
|
||||
<?php } ?>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<article>
|
||||
<header>
|
||||
<?php tpl_includeFile('pageheader.html') ?>
|
||||
</header>
|
||||
<?php tpl_content() /* Actual page content */ ?>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<?php if ($showSidebar): ?>
|
||||
<nav>
|
||||
<?php tpl_includeFile('sidebarheader.html') ?>
|
||||
<?php tpl_include_page($conf['sidebar'], 1, 1) ?>
|
||||
<?php tpl_includeFile('sidebarfooter.html') ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<footer>
|
||||
<?php tpl_includeFile('pagefooter.html') ?>
|
||||
<?php tpl_pageinfo() /* 'Last modified' etc */ ?>
|
||||
<?php if ($showTools): ?>
|
||||
<section>
|
||||
<ul>
|
||||
<?php tpl_toolsevent('pagetools', array(
|
||||
'edit' => tpl_action('edit', 1, 'li', 1),
|
||||
'discussion'=> _tpl_action('discussion', 1, 'li', 1),
|
||||
'revisions' => tpl_action('revisions', 1, 'li', 1),
|
||||
'backlink' => tpl_action('backlink', 1, 'li', 1),
|
||||
'subscribe' => tpl_action('subscribe', 1, 'li', 1),
|
||||
'revert' => tpl_action('revert', 1, 'li', 1),
|
||||
'top' => tpl_action('top', 1, 'li', 1),
|
||||
)); ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* DokuWiki Media Manager Popup
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*/
|
||||
// must be run from within DokuWiki
|
||||
if (!defined('DOKU_INC')) die();
|
||||
@require_once(dirname(__FILE__).'/tpl_functions.php'); /* include hook for template functions */
|
||||
header('X-UA-Compatible: IE=edge,chrome=1');
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang']?>"
|
||||
lang="<?php echo $conf['lang']?>" dir="<?php echo $lang['direction'] ?>" class="popup no-js">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>
|
||||
<?php echo hsc($lang['mediaselect'])?>
|
||||
[<?php echo strip_tags($conf['title'])?>]
|
||||
</title>
|
||||
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
|
||||
<?php tpl_metaheaders()?>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<?php echo tpl_favicon(array('favicon', 'mobile')) ?>
|
||||
<?php tpl_includeFile('meta.html') ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--[if IE 8 ]><div id="IE8"><![endif]-->
|
||||
<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>
|
||||
|
||||
<?php /* keep the id! additional elements are inserted via JS here */?>
|
||||
<div id="media__opts"></div>
|
||||
|
||||
<?php tpl_mediaTree() ?>
|
||||
</div></div>
|
||||
|
||||
<div id="mediamgr__content"><div class="pad">
|
||||
<?php tpl_mediaContent() ?>
|
||||
</div></div>
|
||||
</div>
|
||||
<!--[if lte IE 8 ]></div><![endif]-->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
[stylesheets]
|
||||
|
||||
contents.css = screen
|
||||
layout.css = screen
|
||||
|
||||
[replacements]
|
||||
|
||||
__site_width__ = "40em" ; @ini_site_width
|
||||
__sidebar_width__ = "12em" ; @ini_sidebar_width
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/**
|
||||
* Template Functions
|
||||
*
|
||||
* This file provides template specific custom functions that are
|
||||
* not provided by the DokuWiki core.
|
||||
* It is common practice to start each function with an underscore
|
||||
* to make sure it won't interfere with future core functions.
|
||||
*/
|
||||
|
||||
// must be run from within DokuWiki
|
||||
if (!defined('DOKU_INC')) die();
|
||||
|
||||
/**
|
||||
* Create link/button to discussion page and back
|
||||
*
|
||||
* @author Anika Henke <anika@selfthinker.org>
|
||||
*/
|
||||
function _tpl_discussion($discussionPage, $title, $backTitle, $link=0, $wrapper=0, $return=0) {
|
||||
global $ID;
|
||||
$output = '';
|
||||
|
||||
$discussPage = str_replace('@ID@', $ID, $discussionPage);
|
||||
$discussPageRaw = str_replace('@ID@', '', $discussionPage);
|
||||
$isDiscussPage = strpos($ID, $discussPageRaw) !== false;
|
||||
$backID = ':'.str_replace($discussPageRaw, '', $ID);
|
||||
|
||||
if ($wrapper) $output .= "<$wrapper>";
|
||||
|
||||
if ($isDiscussPage) {
|
||||
if ($link) {
|
||||
ob_start();
|
||||
tpl_pagelink($backID, $backTitle);
|
||||
$output .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
} else {
|
||||
$output .= html_btn('back2article', $backID, '', array(), 'get', 0, $backTitle);
|
||||
}
|
||||
} else {
|
||||
if ($link) {
|
||||
ob_start();
|
||||
tpl_pagelink($discussPage, $title);
|
||||
$output .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
} else {
|
||||
$output .= html_btn('discussion', $discussPage, '', array(), 'get', 0, $title);
|
||||
}
|
||||
}
|
||||
|
||||
if ($wrapper) $output .= "</$wrapper>";
|
||||
if ($return) return $output;
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create link/button to user page
|
||||
*
|
||||
* @author Anika Henke <anika@selfthinker.org>
|
||||
*/
|
||||
function _tpl_userpage($userPage, $title, $link=0, $wrapper=0, $return=0) {
|
||||
if (empty($_SERVER['REMOTE_USER'])) return;
|
||||
|
||||
global $conf;
|
||||
$output = '';
|
||||
$userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage);
|
||||
|
||||
if ($wrapper) $output .= "<$wrapper>";
|
||||
|
||||
if ($link) {
|
||||
ob_start();
|
||||
tpl_pagelink($userPage, $title);
|
||||
$output .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
} else {
|
||||
$output .= html_btn('userpage', $userPage, '', array(), 'get', 0, $title);
|
||||
}
|
||||
|
||||
if ($wrapper) $output .= "</$wrapper>";
|
||||
if ($return) return $output;
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around custom template actions
|
||||
*
|
||||
* @author Anika Henke <anika@selfthinker.org>
|
||||
*/
|
||||
function _tpl_action($type, $link=0, $wrapper=0, $return=0) {
|
||||
switch ($type) {
|
||||
case 'discussion':
|
||||
if (tpl_getConf('discussionPage')) {
|
||||
$output = _tpl_discussion(tpl_getConf('discussionPage'), tpl_getLang('discussion'), tpl_getLang('back_to_article'), $link, $wrapper, 1);
|
||||
if ($return) return $output;
|
||||
echo $output;
|
||||
}
|
||||
break;
|
||||
case 'userpage':
|
||||
if (tpl_getConf('userPage')) {
|
||||
$output = _tpl_userpage(tpl_getConf('userPage'), tpl_getLang('userpage'), $link, $wrapper, 1);
|
||||
if ($return) return $output;
|
||||
echo $output;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* copied to core (available since Detritus)
|
||||
*/
|
||||
if (!function_exists('tpl_toolsevent')) {
|
||||
function tpl_toolsevent($toolsname, $items, $view='main') {
|
||||
$data = array(
|
||||
'view' => $view,
|
||||
'items' => $items
|
||||
);
|
||||
|
||||
$hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
|
||||
$evt = new Doku_Event($hook, $data);
|
||||
if($evt->advise_before()){
|
||||
foreach($evt->data['items'] as $k => $html) echo $html;
|
||||
}
|
||||
$evt->advise_after();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* copied from core (available since Binky)
|
||||
*/
|
||||
if (!function_exists('tpl_classes')) {
|
||||
function tpl_classes() {
|
||||
global $ACT, $conf, $ID, $INFO;
|
||||
$classes = array(
|
||||
'dokuwiki',
|
||||
'mode_'.$ACT,
|
||||
'tpl_'.$conf['template'],
|
||||
!empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '',
|
||||
$INFO['exists'] ? '' : 'notFound',
|
||||
($ID == $conf['start']) ? 'home' : '',
|
||||
);
|
||||
return join(' ', $classes);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue