Beispiel #1
0
/**
 * tpl_getConf($id)
 *
 * use this function to access template configuration variables
 *
 * @param string $id
 * @return string
 */
function tpl_getConf($id)
{
    global $conf;
    static $tpl_configloaded = false;
    $tpl = $conf['template'];
    if (!$tpl_configloaded) {
        $tconf = tpl_loadConfig();
        if ($tconf !== false) {
            foreach ($tconf as $key => $value) {
                if (isset($conf['tpl'][$tpl][$key])) {
                    continue;
                }
                $conf['tpl'][$tpl][$key] = $value;
            }
            $tpl_configloaded = true;
        }
    }
    return $conf['tpl'][$tpl][$id];
}
<?php

/*
 * Provide navigation sidebar functionality to Dokuwiki Templates
 *
 * This is not currently part of the official Dokuwiki release
 *
 * @link   http://wiki.jalakai.co.uk/dokuwiki/doku.php?id=tutorials:dev:navigation_sidebar
 * @author Christopher Smith <*****@*****.**>
 */
// sidebar configuration settings
tpl_loadConfig();
#$conf['sidebar']['enable'] = 1;               // 1 or true to enable sidebar functionality, 0 or false to disable it
#$conf['sidebar']['page'] = 'navigate';        // name of sidebar page
#$conf['sidebar']['layout'] = 'inside';        // inside (between button bars) or outside (full height of dokuwiki)
#$conf['sidebar']['orientation'] = 'left';     // left or right
#$conf['sidebar']['showeditbtn'] = 1;          // show a sidebar edit button IF USER HAS EDIT PERMISSION FOR SIDEBAR
$lang['btn_sidebaredit'] = 'edit sidebar';
// determine the sidebar class
$sidebar_class = "sidebar_" . tpl_getConf('layout') . '_' . tpl_getConf('orientation');
// recursive function to establish best sidebar file to be used
function getSidebarFN($ns, $file)
{
    // check for wiki page = $ns:$file (or $file where no namespace)
    $nsFile = $ns ? "{$ns}:{$file}" : $file;
    if (file_exists(wikiFN($nsFile)) && auth_quickaclcheck($nsFile)) {
        return $nsFile;
    }
    // remove deepest namespace level and call function recursively
    // no namespace left, exit with no file found
    if (!$ns) {