This article deals with description how to use different favicon images for different web sites developed within one instance of Kentico CMS.
Find this file <your project folder>\App_Code\CMSPages\DocumentBase.cs and open it to edit. Now you need to add a decision statement which will ensure displaying different images for the web sites. It could be done like this:

public string FavIconTag
    {
        get
        {
            if (mFavIconTag == null)
            {

                string filePath = null;
                string resolveUrlIcon = null;
                string SiteIcon1 = "~/favicon1.ico";
                string SiteIcon2 = "~/favicon2.ico";

                if (this.mCurrentSite.DisplayName.ToString() == "site_display_name")
                {
                    filePath = HttpContext.Current.Server.MapPath(SiteIcon1);
                    resolveUrlIcon = SiteIcon1;
                }

                else
                {
                    filePath = HttpContext.Current.Server.MapPath(SiteIcon2);
                    resolveUrlIcon = SiteIcon2;
                }


               
                if (File.Exists(filePath))
                {
                    mFavIconTag = "<link rel=\"shortcut icon\" href=\"" + ResolveUrl(resolveUrlIcon) + "\" />";
                }
                else
                {
                    mFavIconTag = "";
                }
            }

            return mFavIconTag;
        }
    }


It is also possible to disable favicon feature in the same file by changing (commenting) following code:

    // Favicon
    tags += FavIconTag;


to:

    // Favicon
  // tags += FavIconTag;




See also:


Applies to: 3.x
Created on 8/20/2008 4:05:49 AM in API and Internals
 


Sitemap | Copyright 2008 Kentico software | Powered by Kentico