/// <summary> /// 初始化当前页面模板数据 /// </summary> protected void InitPageTemplate() { #region 获取文档内容 //获取要生成的栏目ID archiveID = Utils.GetQueryInt("ID"); if (archiveID < 0) { Message.Dialog("生成错误,生成静态页的文档ID为空!", "-1", MessageIcon.Warning); } //获取栏目类型 channelType = Utils.GetQueryInt("type"); if (channelType < 0) { ArcListBLL arclistBll = new ArcListBLL(); Message.Dialog("生成错误,请选择要生成的文档类型!", "-1", MessageIcon.Warning); } //获取生成文档当前页数,默认为第一页 pageIndex = Utils.GetQueryInt("page"); if (pageIndex < 0) { pageIndex = 1; } ArcListBLL arcBll = new ArcListBLL(); List <Archive> archiveInfo = arcBll.GetArchiveInfo(archiveID, channelType); if (archiveInfo.Count > 0) { channelID = archiveInfo[0].ClassID; } else { return; } #endregion #region 获取当前位置 ArchiveField gobal = new ArchiveField(); //获取栏目当前位置 classUrl = this.__CLASSURL.Value; position = this.__POSITION.Value; relation = this.__RELATION.Value; if (classUrl.Length == 0 || relation.Length == 0) { Arc_ClassBLL classBll = new Arc_ClassBLL(); Arc_Class classInfo = classBll.GetModel(channelID); classUrl = this.__CLASSURL.Value = classInfo.ClassPath; relation = this.__RELATION.Value = classInfo.Relation.TrimEnd('.').Replace('.', ','); } if (position.Length == 0) { Arc_ClassBLL classBll = new Arc_ClassBLL(); DataTable dt = classBll.GetThisPlace(relation); position += "<a href=\"/\">首页</a> » "; for (int i = 0; i < dt.Rows.Count; i++) { position += "<a href=\"" + dt.Rows[i]["ClassEName"] + "\">" + dt.Rows[i]["ClassName"] + "</a>"; if (i + 1 < dt.Rows.Count) { position += " » "; } } this.__POSITION.Value = gobal.Position = position; } #endregion #region 获取上一篇、下一篇链接 int count = archiveInfo.Count; for (int i = 1; i < count; i++) { if (archiveInfo[i] != null) { string temp = "<a href=\"" + archiveInfo[i].Url + "\">" + archiveInfo[i].Title + "</a>"; if (archiveInfo[i].ID < archiveID) { gobal.Prior = temp; } else { gobal.Next = temp; } } } #endregion #region 获取配置信息 SiteConfigInfo site = ConfigAccess.LoadConfig <SiteConfigInfo>("CFG_SITE"); #endregion this.Document.Variables.SetValue("field", archiveInfo[0]); this.Document.Variables.SetValue("gobal", gobal); this.Document.Variables.SetValue("site", site); }