Пример #1
0
        public static List <Item> GetBreadcrumbTrail(this Item item)
        {
            List <Item> items = new List <Item>();
            var         sc    = SiteExtensions.GetContextSite();

            if (sc != null)
            {
                var startItem = Sitecore.Context.Database.GetItem(sc.StartPath);
                if (startItem != null)
                {
                    Item currentItem = item;
                    items.Add(currentItem);
                    while (!currentItem.ID.Equals(startItem.ID))
                    {
                        currentItem = currentItem.Parent;
                        if (currentItem == null)
                        {
                            return(new List <Item>());
                        }

                        items.Insert(0, currentItem);
                    }
                }
            }

            return(items);
        }
Пример #2
0
        public static IHtmlString GetCDNFooterScripts(this HtmlHelper helper)
        {
            //Get CDN Helper Prefix from Sitecore Setting.
            var site   = SiteExtensions.GetContextSite();
            var cdnURL = GetFormattedCdnHostName(site.Properties["cdnHostName"]);

            return(helper.GetFooterScripts(cdnURL));
        }