Favicons?

I'd really appreciate it if anyone is willing to share enough lore for to help me install a facicon on my Elgg site. I've got a cute one working with our MediaWiki and Moodle sites, but Elgg's PHP coding specs are different enough that I haven't been able to figure out where we need to put the instruction to load the favicon.

Thanks.

BobBl

  • Well, I just uploaded my favicon to the root folder of the server and it automatically appears in firefox, opera, IE7 and google chrome. I haven't tried this... but you could try inserting the code in: views > default > page_elements > header_contents.php. Hopes this helps in some way.

  • Not working for me. It's in the root directly and linked in the header.php file. Nothing showing up...

  • It was suppose to be in the root directory to work throughout the site and shouldn't have required some code, but it doesn't work. It's too complicated for Elgg to deal with favicons. However in some cases the following code in the index.php might work for you:

    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

    Make sure your Favicon.ico is of size 16x16. And good luck, tho I doubt it would work but try your luck and in case someone else have it working, do let us know the trick.

     

     

  • Ahh I got it.  The code is not even required (in some cases it does tho, specially when you are running an html based website) but in elgg case, you don't.

    Simply put the "favicon.ico" file in your site's root folder and leave it for a day or two. It will appear. Mine just got appeared after almost 30 hours of uploading favicon.ico file to the root folder of my site.

    I guess it's just wait and watch game. Good luck and do let me know if that worked.

    p.s. make sure your file name is all lower case "favicon.ico" and if its a valid icon file, it should work, 100%, without putting any code.

  • I don't know about waiting and hoping the favicon appears. What I do know is that Carter was partially correct with the string of code above.

    You need to add the code somewhere between <head> and </head> in the header file of your theme in views/default/page_elements/header.php

    The link needs to point to where the favicon actually is. ie full path

    <link rel="shortcut icon" href="http://www.yourdomain.com/whicheverfolder/favicon.ico" >
  • I finally was able to make it show up. I'm going to explain everything I did here in case anybody in the future has any problems doing this. I hope this can help everybody who may have trouble getting their favicon showing up.

    1. Create a favicon.ico file with the image you want to show up on the browser's tab. NOTE: Make sure the image size is 16x16 BEFORE you use a favicon generator. The first time around, I used a random size and it didn't work for some reason, so I recommend you use some kind of image editor to ensure that the image is 16x16. You can create a favicon of your image here: http://tools.dynamicdrive.com/favicon/.

    2. Upload your favicon.ico file onto your root folder. That's where your site begins, so that it will read www.yourdomain.com/favicon.ico.

    3. Go to header.php in page_elements and open it up. Below the echo elgg_view(meta_tags) (it reads something like that), put the following link:

    <link rel="shortcut icon" type="image/x-icon" href="http://yourdomain.com/favicon.ico"&gt;

    Note: Make sure that you have the href with your full domain name pointing to where your favicon is. If you just put a shortcut, say "/favicon.ico," it will not work.

    4. Save the php file and transfer it to your server. Refresh your page and you should be set.

    5. One more thing to keep in mind. Some plugins have their own headers because they use additional javascript. In particular, Snow's Straycat_Bag Plugin does this. It will basically override the header.php in your default views folder. If you are using a plugin like this one, you will have to go to the header.php file this plugin has so that it will actually work. Otherwise, your site won't be reading the right header.php file and your favicon won't show up.

    That's all! I hope this closes this issue for good for all Elgg users. Enjoy!

  • Nice write up rym87.  Hopefully will help out lots of people.

    However, it's a much better solution to extend the meta_tags view than to edit the header.php file directly.  Extending won't run into problems when plugins and themes unwisely override the header.php file.

  • Thanks for the recommendation Brett. Can you quickly explain how to extend the meta_tags view?

  • Hi all,

    As rym87 explained, i followed the whole procedure, uploaded the favicon, put the link above the elgg_view in the header.php and saved it.

    when i refreshed it, I am able the see the favicon in Google Chrome but not able to see the same in Mozilla.

    Can any one help me.

    Thanks,

    Scodes

    http://www.scodes.in/