Ejemplo n.º 1
0
        /// <summary>
        /// 加载页面模板
        /// </summary>
        /// <param name="PageID"></param>
        /// <returns></returns>
        public JsonResult RenderTemplateToPage(string PageId)
        {
            PageId = GetPageId(PageId);
            SitePage         CurrentSitePage     = this.Engine.SiteManager.GetPage(PageId);
            SitePageTemplate CurrentPageTemplate = this.Engine.SiteManager.GetPageTemplate(CurrentSitePage.TemplateId);

            string PageTemplateContent = CurrentPageTemplate == null ? string.Empty : CurrentPageTemplate.HtmlContent;

            //string jsvar = PageTemplateContent;
            string Title = this.SetPageTitle(CurrentSitePage, CurrentPageTemplate);
            //List<string> WebPartInstValue = this.WebPartInstValue(PageId);
            List <object>   WebPartInstValue = this.WebPartInstValue(PageId);
            List <ListItem> AllWebParts      = this.GetWebParts();
            var             result           = new
            {
                PageId = PageId,
                Title  = Title,
                PageTemplateContent = PageTemplateContent,
                WebPartInstValue    = WebPartInstValue,
                //WebPartInstValue_Bak = WebPartInstValue_Bak,
                AllWebParts = AllWebParts,
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 设置页面标题
        /// </summary>
        /// <returns></returns>
        public string SetPageTitle(SitePage CurrentSitePage, SitePageTemplate CurrentPageTemplate)
        {
            string Title = "";

            if (CurrentSitePage != null && !string.IsNullOrEmpty(CurrentSitePage.Title))
            {
                Title = CurrentSitePage.Title;
            }
            else if (CurrentPageTemplate != null && !string.IsNullOrEmpty(CurrentPageTemplate.TemplateName))
            {
                Title = CurrentPageTemplate.TemplateName;
            }
            else
            {
                Title = "Top_Home";//首页,多语言支持
            }
            return(Title);
        }