made favicon.ico more flexible (use from data/media only if it exists, otherwise from tpl)

This commit is contained in:
Anika Henke 2010-11-07 13:15:33 +00:00
parent 8fdcbb446b
commit a21fd4b9fa
3 changed files with 15 additions and 1 deletions

BIN
images/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

@ -18,7 +18,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title> <title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
<?php tpl_metaheaders() ?> <?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 */ ?> <?php @include(dirname(__FILE__).'/meta.html') /* include hook */ ?>
</head> </head>

View file

@ -4,6 +4,8 @@
* *
* This file provides template specific custom functions that are * This file provides template specific custom functions that are
* not provided by the DokuWiki core. * 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 // must be run from within DokuWiki
@ -64,3 +66,15 @@ function _tpl_userpage($userNS='user',$link=0,$wrapper=false) {
if ($wrapper) echo "</$wrapper>"; 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';
}