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


C# Template.contentPlaceholderIds方法代码示例

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


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

示例1: MakeNew

        public static Template MakeNew(string Name, BusinessLogic.User u, Template master)
        {
            //ensure unique alias
            if (GetByAlias(Name) != null)
                Name = EnsureUniqueAlias(Name, 1);

            Template t = MakeNew(Name, u);
            t.MasterTemplate = master.Id;
            t.Design = "";

            if (UmbracoSettings.UseAspNetMasterPages)
            {
                string design = t.getMasterPageHeader() + "\n";

                foreach (string cpId in master.contentPlaceholderIds())
                {
                    design += "<asp:content ContentPlaceHolderId=\"" + cpId + "\" runat=\"server\">\n\t\n</asp:content>\n\n";
                }

                t.Design = design;
            }

            t.Save();
            return t;
        }
开发者ID:jracabado,项目名称:justEdit-,代码行数:25,代码来源:Template.cs

示例2: CreateDefaultMasterPageContent

        internal static string CreateDefaultMasterPageContent(Template template, string currentAlias)
        {
            string design = GetMasterPageHeader(template) + "\n";

            if (template.HasMasterTemplate)
            {
                var master = new Template(template.MasterTemplate);

                foreach (string cpId in master.contentPlaceholderIds())
                {
                    design += "<asp:content ContentPlaceHolderId=\"" + cpId +
                              "\" runat=\"server\">\n\t\n</asp:content>\n\n";
                }
            }
            else
            {
                design += GetMasterContentElement(template) + "\n";
                design += template.Design;
                design += "\n</asp:Content>" + Environment.NewLine;
            }

            return design;


            /*
            var masterPageContent = template.Design;

            if (!IsMasterPageSyntax(masterPageContent))
                masterPageContent = ConvertToMasterPageSyntax(template);

            // Add header to master page if it doesn't exist
            if (!masterPageContent.TrimStart().StartsWith("<%@"))
            {
                masterPageContent = GetMasterPageHeader(template) + "\n" + masterPageContent;
            }
            else
            {
                // verify that the masterpage attribute is the same as the masterpage
                string masterHeader =
                    masterPageContent.Substring(0, masterPageContent.IndexOf("%>") + 2).Trim(
                        Environment.NewLine.ToCharArray());

                // find the masterpagefile attribute
                MatchCollection m = Regex.Matches(masterHeader, "(?<attributeName>\\S*)=\"(?<attributeValue>[^\"]*)\"",
                                                  RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
                
                foreach (Match attributeSet in m)
                {
                    if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
                    {
                        // validate the masterpagefile
                        string currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
                        string currentMasterTemplateFile = ParentTemplatePath(template);

                        if (currentMasterPageFile != currentMasterTemplateFile)
                        {
                            masterPageContent =
                                masterPageContent.Replace(
                                    attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
                                    attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
                                    "\"");
                        }
                    }
                }

            }
            
            return masterPageContent;
             * */
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:70,代码来源:MasterpageHelper.cs


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