コード例 #1
0
        public IEnumerable <PageTemplateDescriptor> GetPageTemplates()
        {
            using (var conn = new DataConnection(PublicationScope.Published))
            {
                var result = new List <PageTemplateDescriptor>();

                foreach (var xmlPageTemplate in conn.Get <IXmlPageTemplate>())
                {
                    string defaultPlaceholderId;
                    PlaceholderDescriptor[] placeholders;

                    ParseLayoutFile(xmlPageTemplate, out placeholders, out defaultPlaceholderId);

                    PageTemplateDescriptor descriptor = new XmlPageTemplateDescriptor(xmlPageTemplate)
                    {
                        Id    = xmlPageTemplate.Id,
                        Title = xmlPageTemplate.Title,
                        DefaultPlaceholderId    = defaultPlaceholderId,
                        PlaceholderDescriptions = placeholders
                    };

                    result.Add(descriptor);
                }

                return(result);
            }
        }
コード例 #2
0
        public IEnumerable<PageTemplateDescriptor> GetPageTemplates()
        {
            using (var conn = new DataConnection(PublicationScope.Published))
            {
                var result = new List<PageTemplateDescriptor>();

                foreach (var xmlPageTemplate in conn.Get<IXmlPageTemplate>())
                {
                    string defaultPlaceholderId;
                    PlaceholderDescriptor[] placeholders;

                    ParseLayoutFile(xmlPageTemplate, out placeholders, out defaultPlaceholderId);

                    PageTemplateDescriptor descriptor = new XmlPageTemplateDescriptor(xmlPageTemplate)
                    {
                        Id = xmlPageTemplate.Id,
                        Title = xmlPageTemplate.Title,
                        DefaultPlaceholderId = defaultPlaceholderId,
                        PlaceholderDescriptions = placeholders
                    };

                    result.Add(descriptor);
                }

                return result;
            }
        }