当前位置: 首页>>代码示例>>C#>>正文


C# IPublishedContent.AncestorOrSelf方法代码示例

本文整理汇总了C#中IPublishedContent.AncestorOrSelf方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.AncestorOrSelf方法的具体用法?C# IPublishedContent.AncestorOrSelf怎么用?C# IPublishedContent.AncestorOrSelf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPublishedContent的用法示例。


在下文中一共展示了IPublishedContent.AncestorOrSelf方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GlobalModel

        public GlobalModel(IPublishedContent content)
        {
            var rootNode = content.AncestorOrSelf(1);

            CompanyName = rootNode.GetPropertyValue<string>("companyName");
            CompanyAddress = rootNode.GetPropertyValue<string>("companyAddress");
            CompanyPhone = rootNode.GetPropertyValue<string>("companyPhone");
            CompanyEmail = rootNode.GetPropertyValue<string>("companyEmail");
        }
开发者ID:BarryFogarty,项目名称:AngularPoweredUmbracoFrontend,代码行数:9,代码来源:GlobalModel.cs

示例2: Map

        public static IntranetMaster Map(IPublishedContent content, IntranetMaster model)
        {
            // Reference to the root (frontpage) node
            IPublishedContent rootNode = content.AncestorOrSelf(1);

            //Reference to the level 2 node
            IPublishedContent level2Node = content.AncestorOrSelf(2);

            // Get main navigation
            //model.MainNavigation = NavigationMapper.GetMainNavigation(rootNode, content);

            // Get top navigation
            //model.TopNavigation = NavigationMapper.GetTopNavigation(rootNode, content);

            model.LeftNavigation = NavigationMapper.GetIntranetMainNavigation(level2Node, content);

            model.MetaDescription = content.GetProperty("metaDescription") != null
                                        ? content.GetPropertyValue<string>("metaDescription")
                                        : string.Empty;

            model.MetaKeywords = content.GetProperty("metaKeywords") != null
                                     ? content.GetPropertyValue<string>("metaKeywords")
                                     : string.Empty;

            model.RedirectUrl = content.GetProperty("redirectURL") != null
                                    ? content.GetPropertyValue<string>("redirectURL")
                                    : string.Empty;

            model.BodyCssClass = level2Node != null
                                     ? level2Node.GetPropertyValue<string>("cssClassName")
                                     : string.Empty;

            model.SiteName = rootNode.GetProperty("siteName") != null
                                 ? rootNode.GetPropertyValue<string>("siteName")
                                 : string.Empty;

            model.SiteDescription = rootNode.GetProperty("siteDescription") != null
                                 ? rootNode.GetPropertyValue<string>("siteDescription")
                                 : string.Empty;

            model.Name = content.Name;

            return model;
        }
开发者ID:pjengaard,项目名称:lilleGrundetDk,代码行数:44,代码来源:IntranetMasterMapper.cs

示例3: GetFromContent

        //public Footer Footer { get; private set; }
        public static Settings GetFromContent(IPublishedContent content, Settings model)
        {
            IPublishedContent root = content.AncestorOrSelf(1);

            model.Email = root.GetPropertyValue<string>("email");
            model.Mobile = root.GetPropertyValue<string>("mobile");
            model.Sitename = root.GetPropertyValue<string>("sitename");

            //model.Footer = Footer.GetFromContent(content, new Footer());

            return model;
        }
开发者ID:pjengaard,项目名称:idebankDk,代码行数:13,代码来源:Settings.cs

示例4: Map

        public static IEnumerable<MenuItem> Map(IPublishedContent currentPage, bool sideNav = false)
        {
            List<MenuItem> menuItemList = new List<MenuItem>();

            MenuItem frontPage = new MenuItem();
            var siteRoot = currentPage.AncestorOrSelf(1);

            if (!siteRoot.GetPropertyValue<bool>("umbracoNaviHide"))
            {
                frontPage.Name = siteRoot.Name;
                frontPage.Url = siteRoot.Url;
                menuItemList.Add(frontPage);
            }

            foreach (var child in siteRoot.Children.Where(x => x.GetPropertyValue<bool>("showInTopMenu") == sideNav && x.GetPropertyValue<bool>("umbracoNaviHide") == false))
            {
                MenuItem menuItem = new MenuItem();
                menuItem.Name = child.Name;

                if (child.IsDocumentType("Link"))
                {
                    menuItem.OpenInNewWindow = child.GetPropertyValue<bool>("targetNewWindow");
                    menuItem.Url = child.GetPropertyValue<string>("linkUrl");
                }
                else
                {
                    menuItem.Url = child.Url;
                }
                menuItemList.Add(menuItem);
            }
            if (menuItemList.Any())
            {
                return menuItemList;
            }
            return null;
        }
开发者ID:Tjornfelt,项目名称:MouretInterieur,代码行数:36,代码来源:NavigationMapper.cs

示例5: IsHomepageOf

 public static bool IsHomepageOf(IPublishedContent homepage, IPublishedContent someNode)
 {
     var someNodesHomepage = someNode.AncestorOrSelf("Homepage");
     return someNodesHomepage.Id.Equals(homepage.Id);
 }
开发者ID:rubenski,项目名称:pvista,代码行数:5,代码来源:HomepageHelper.cs

示例6: GetFooterChildNodes

 private List<IPublishedContent> GetFooterChildNodes(IPublishedContent node)
 {
     var homePage = node.AncestorOrSelf(1);
     var footer = homePage.Children.FirstOrDefault(content => content.DocumentTypeAlias.Equals("Footer", StringComparison.OrdinalIgnoreCase));
     if (footer == null)
         return new List<IPublishedContent>();
     return footer.Children.ToList();
 }
开发者ID:nicolasmetaye,项目名称:DynamicLoopCompany,代码行数:8,代码来源:MasterMap.cs

示例7: BaseModel

 public BaseModel(IPublishedContent content)
     : base(content)
 {
     this.HomePage = content.AncestorOrSelf(1);
 }
开发者ID:Svetlin-Slavchev,项目名称:Umbraco-Template,代码行数:5,代码来源:BaseModel.cs

示例8: SinglePageOfType

 public static IPublishedContent SinglePageOfType(this UmbracoHelper umbraco, IPublishedContent currentPage,
     string nodeTypeAlias)
 {
     var home = currentPage.AncestorOrSelf(1);
     var xpath = String.Format("//{0}[@id={1}]//{2}",home.DocumentTypeAlias, home.Id,nodeTypeAlias);
     var node = umbraco.TypedContentSingleAtXPath(xpath);
     return node;
 }
开发者ID:bgadiel,项目名称:tt,代码行数:8,代码来源:PublishedContentExtensions.cs


注:本文中的IPublishedContent.AncestorOrSelf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。