예제 #1
0
        /// <summary>
        /// Get home page item
        /// </summary>
        /// <returns></returns>
        public static HomePageItem GetHomePageItem()
        {
            MainsectionItem objSiteItem     = GetSiteRoot();
            HomePageItem    objHomepageItem = null;

            if (objSiteItem != null)
            {
                objHomepageItem = GetHomeItem();
            }
            return(objHomepageItem);
        }
예제 #2
0
        /// <summary>
        /// Get first instance(item) of GlobalsItem template under the site root
        /// </summary>
        /// <returns></returns>
        public static GlobalsItem GetGlobals()
        {
            MainsectionItem objSiteItem = GetSiteRoot();

            if (objSiteItem != null)
            {
                var children = objSiteItem.InnerItem.Children;
                if (children != null)
                {
                    return(children.FirstOrDefault(i => i.IsOfType(GlobalsItem.TemplateId)));
                }
            }
            return(null);
        }
예제 #3
0
        /// <summary>
        /// Get website root item
        /// </summary>
        /// <returns></returns>
        public static MainsectionItem GetSiteRoot()
        {
            MainsectionItem objSiteItem = Sitecore.Context.Database.GetItem(Sitecore.Context.Site.RootPath);

            if (objSiteItem != null && objSiteItem.InnerItem.HasContextLanguageVersion())
            {
                return(objSiteItem);
            }
            else
            {
                Sitecore.Context.Database.GetItem(Sitecore.Context.Site.RootPath, Sitecore.Data.Managers.LanguageManager.GetLanguage("en"));
                return(objSiteItem);
            }
        }