summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2010-11-07 13:15:33 +0000
committerAnika Henke <anika@selfthinker.org>2010-11-07 13:15:33 +0000
commita21fd4b9fa168f867852150b109fcd7da2e59996 (patch)
tree51f7af7f61ba6f805cb5bdc4404bc4cdf8141b21
parent8fdcbb446b412f81b3336cfe9af73efe561a6633 (diff)
downloadrpg-a21fd4b9fa168f867852150b109fcd7da2e59996.tar.gz
rpg-a21fd4b9fa168f867852150b109fcd7da2e59996.tar.bz2
made favicon.ico more flexible (use from data/media only if it exists, otherwise from tpl)
-rw-r--r--images/favicon.icobin0 -> 7406 bytes
-rw-r--r--main.php2
-rw-r--r--tpl_functions.php14
3 files changed, 15 insertions, 1 deletions
diff --git a/images/favicon.ico b/images/favicon.ico
new file mode 100644
index 000000000..8b9616abb
--- /dev/null
+++ b/images/favicon.ico
Binary files differ
diff --git a/main.php b/main.php
index 23f3f2d24..0150d37cc 100644
--- a/main.php
+++ b/main.php
@@ -18,7 +18,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
<?php tpl_metaheaders() ?>
- <link rel="shortcut icon" href="<?php echo ml('favicon.ico') ?>" />
+ <link rel="shortcut icon" href="<?php echo _tpl_getFavicon() ?>" />
<?php @include(dirname(__FILE__).'/meta.html') /* include hook */ ?>
</head>
diff --git a/tpl_functions.php b/tpl_functions.php
index 0dfee9595..d258ed38b 100644
--- a/tpl_functions.php
+++ b/tpl_functions.php
@@ -4,6 +4,8 @@
*
* 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
@@ -64,3 +66,15 @@ function _tpl_userpage($userNS='user',$link=0,$wrapper=false) {
if ($wrapper) echo "</$wrapper>";
}
+
+/**
+ * Use favicon.ico from data/media root directory if it exists, otherwise use
+ * the one in the template's image directory.
+ *
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+function _tpl_getFavicon() {
+ if (file_exists(mediaFN('favicon.ico')))
+ return ml('favicon.ico');
+ return DOKU_TPL.'images/favicon.ico';
+}