diff options
author | Anika Henke <anika@selfthinker.org> | 2011-01-03 20:53:49 +0000 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2011-01-03 20:53:49 +0000 |
commit | 383a53f459aaeed3cad97bfbcf22d22a7be87de9 (patch) | |
tree | 04aea68b00af6c5334edc47fda0e4a60ac5e8053 | |
parent | b49f0667ba86f32655c5959b87d21090ee581b38 (diff) | |
download | rpg-383a53f459aaeed3cad97bfbcf22d22a7be87de9.tar.gz rpg-383a53f459aaeed3cad97bfbcf22d22a7be87de9.tar.bz2 |
made include hooks more flexible (especially for farms: put included file into conf directory)
-rw-r--r-- | main.php | 10 | ||||
-rw-r--r-- | tpl_functions.php | 16 |
2 files changed, 21 insertions, 5 deletions
@@ -19,7 +19,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER <title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title> <?php tpl_metaheaders() ?> <link rel="shortcut icon" href="<?php echo _tpl_getFavicon() /* DW versions > 2010-11-12 can use the core function tpl_getFavicon() */ ?>" /> - <?php @include(dirname(__FILE__).'/meta.html') /* include hook */ ?> + <?php _tpl_include('meta.html') ?> </head> <body> @@ -32,7 +32,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER <?php /* .dokuwiki should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?> <div id="dokuwiki__site"><div class="dokuwiki site mode_<?php echo $ACT ?>"> <?php html_msgarea() /* occasional error and info messages on top of the page */ ?> - <?php @include(dirname(__FILE__).'/header.html') /* include hook */ ?> + <?php _tpl_include('header.html') ?> <!-- ********** HEADER ********** --> <div id="dokuwiki__header"><div class="pad"> @@ -113,7 +113,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER <!-- ********** CONTENT ********** --> <div id="dokuwiki__content"><div class="pad"> <?php tpl_flush() /* flush the output buffer */ ?> - <?php @include(dirname(__FILE__).'/pageheader.html') /* include hook */ ?> + <?php _tpl_include('pageheader.html') ?> <div class="page"> <!-- wikipage start --> @@ -123,7 +123,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER </div> <?php tpl_flush() ?> - <?php @include(dirname(__FILE__).'/pagefooter.html') /* include hook */ ?> + <?php _tpl_include('pagefooter.html') ?> </div></div><!-- /content --> <div class="clearer"></div> @@ -154,7 +154,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER <?php tpl_license('button') /* content license, parameters: img=*badge|button|0, imgonly=*0|1, return=*0|1 */ ?> </div></div><!-- /footer --> - <?php @include(dirname(__FILE__).'/footer.html') /* include hook */ ?> + <?php _tpl_include('footer.html') ?> </div></div><!-- /site --> <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div> diff --git a/tpl_functions.php b/tpl_functions.php index 784813272..cadf400e4 100644 --- a/tpl_functions.php +++ b/tpl_functions.php @@ -93,3 +93,19 @@ function _tpl_getFavicon() { return ml('favicon.ico'); return DOKU_TPL.'images/favicon.ico'; } + +/** + * Include additional html file from conf directory if it exists, otherwise use + * file in the template's root directory. + * + * @author Anika Henke <anika@selfthinker.org> + */ +function _tpl_include($fn) { + $confFile = DOKU_CONF.$fn; + $tplFile = dirname(__FILE__).'/'.$fn; + + if (file_exists($confFile)) + include($confFile); + else if (file_exists($tplFile)) + include($tplFile); +} |