views:

36

answers:

1

I know this is a stupid question, but I can't find the answer anywhere. If I'm using Codeigniter, where do I save my favicon file so that it will pop up in the browser? Or is there a config option in the files that I haven't been able to find yet? This is driving me crazy!

Thanks a lot for the help.

+3  A: 

It depends on your organization. I usually put the favicon.gif file in the web root folder, so the URL would be yourdomain.com/favicon.gif

Then you have to add the following line of code into your HTML <head>:

<link rel="icon" href="<?=base_url()?>/favicon.gif" type="image/gif">

Assuming that the URL Helper is loaded in CodeIgniter. You can load it via $this->load->helper('url'); or add it into the autoload helper array in your config folder.

David
darn... beat me to it!You could just make the link /favicon.gif if it's in the site root, instead of calling the helper.
Chris
Of course! But since I am running CodeIgniter applications on a local server for testing and publish them when finished, I want them to be as dynamic as possible so publishing is no pain.
David
Worked like a charm, of course. I've designed them before, but never had to include a link -- always get them auto-detected by browser somehow. Thanks!!
tchaymore
Glad to hear! :)Some browsers (e.g. Safari) try to auto-detect a favicon like you said.For example, if you visit www.typolexikon.de Safari tries to load www.typolexikon.de/favicon.ico which returns a 404 page about 10 times as large as a favicon would be.
David