Wikka favicon.ico
I've uploaded a minipicture derived from the Wikka wizard to be used as a
favicon:
images/favicon.ico
The code
The following lines were added to
actions/header.php:
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
Issues
- Some browsers try to retrieve a favicon.ico file if it exists in the server root, even if it is not declared in the page's head. To keep favicon.ico at root level, a minor change in the .htaccess is needed.
- There is disagreement on the MIME type required for favicons. I've used: image/x-icon.
Feedback is welcome
With the current method, default favicon.ico need to be overwritten by a personalized one.
Problems:
- update : updating a wikka installation (folder copy) erase custom favicon.ico
-
w3 : png support would be greater for linux users (only for 2nd proposal)
Proposal:
- add
'favicon' => 'images/favicon.ico' parameter to wikka.config.php
actions/header.php:
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
// ===== favicon =====
$favicon =
$this->
GetConfigValue("favicon");
if ($favicon ==
'') { $favicon =
'images/favicon.ico';
}
echo ' <link rel="icon" href="'.
$favicon.
'" type="image/x-icon" />'.
"\n";
echo ' <link rel="shortcut icon" href="'.
$favicon.
'" type="image/x-icon" />'.
"\n";
- best (only useful when when pigs might fly and ie support standards) :
// ===== favicon =====
$favicon =
$this->
GetConfigValue("favicon");
if ($favicon ==
'') { $favicon =
'images/favicon.ico';
}
if (substr($favicon, -
4) ==
".png") {
echo ' <link rel="icon" type="image/png" href="'.
$favicon.
'" />'.
"\n";
} elseif (substr($favicon, -
4) ==
".gif") {
echo ' <link rel="icon" type="image/gif" href="'.
$favicon.
'" />'.
"\n";
} elseif (substr($favicon, -
4) ==
".ico") {
echo ' <link rel="icon" href="'.
$favicon.
'" type="image/x-icon" />'.
"\n";
echo ' <link rel="shortcut icon" href="'.
$favicon.
'" type="image/x-icon" />'.
"\n";
}
note : could it be useful to allow disabling favicon? ('favicon' => 'none')
CategoryWikka