Wiki source for FaviconDotIco


Show raw source

=====Favicon=====
Did you ever heard about favicon.ico and [[http://wikka.jsnx.com/RobotsDotTxt | robots.txt]]?
I think it's MicroSoft who used favicon.ico the first.
favicon.ico is an icon file, normally placed at your root web directory, ie in the case of this wikka site, the url pointed to by ""http://wikka.jsnx.com/favicon.ico"". It is meant to personnalize your site, and when the visitor add your site to his favourites, his browser use the icon favicon.ico, instead of the default. favicon.ico should be also displayed at the address bar. On some browsers, you need to specify this statement in every page :
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">

(Try this with konqueror, Linux).

My problem with wikka 1.1.3 is that when the browser tries to load the file favicon.ico, it get the file ""http://yourhost/wakka.php?wakka=favicon.ico""

To resolve this, I insert these lines in the top of wakka.php :
%%(php)<?
if (($_REQUEST['wakka'] == 'favicon.ico') || ($_REQUEST['wakka'] == 'robots.txt'))
{
if ($_REQUEST['wakka'] == 'favicon.ico')
{
header("Content-Type: images/x-icon");
include ('images/' . $_REQUEST['wakka']);
}
if ($_REQUEST['wakka'] == 'robots.txt')
{
header("Content-Type: text/plain");
include ($_REQUEST['wakka']);
}
die();
}
?>%%

Again, we can improve this by testing if $_REQUEST['wakka'] is terminated by .ico or .txt, and use file_exists before include().

(this is an overkill IMHO, see an easier way at RobotsDotTxt, --MinusF)
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki