In my case I have
- favicon.ico on uploads/misc directory
- Test on WAMP server (multisite server)
- Deploy on a CPanel shared hosted for only one site per account
- Pretty_URLS Active on both TEST and PRODUCTION
- Some sites need flat pretty_urls some sites don't
- Use the favicon UDT
Why?
If you use relative paths over non flat pretty_urls you will have the path to favicon relative to current content level on content tree
If you use flat pretty_urls your client might want tomorrow to change to non-flat pretty_urls.
The solution might be to use absolute path for favicon, that works ok on single site shared host, but if you try to use absolute path on multisite server you may end up with absolute paths pointing to your /home directory.
So, sometimes you may have favicon working on start page and not working on rest of site, or not working at all. Or favicon working on production site, but not on test server.
You can change the paths to favicon on test site, and then rearrange them to work on production, but if you use more than a couple of templates it might become a PITA on the long run.
The solution is to use the {root_url} tag for creating dynamic absolute paths (sounds weird uh. Always tought dynamic and absolute are mutually excluding) inside the {favicon} udt
Since you can't call to {root_url} inside the {favicon} udt. And like Calguy says "Smarty is smart but not that smart" (talking about nested smarty tags on another thread in this forum) I took his approach and got to this:
Code: Select all
{capture assign='root_url'} {root_url}{/capture}
{favicon static="$root_url/uploads/misc/favicon.ico"}
the result will be this line generated on your html
Code: Select all
<link rel="shortcut icon" href=" http://yourserver/CMSMS_ROOT/uploads/misc/waterland.ico" type="image/x-icon" />
Hope this is helpful and avoid some headaches to some not so experienced webmasters (like myself).
Regards.