/// <summary> /// GEs the t_ DATE. /// </summary> /// <param name="Con">The con.</param> /// <returns></returns> public string ArticlsHtml(HttpContext Con) { //初始化一些参数 this.Context = Con; this.type = Context.Request["type"]; this.bh = Context.Request["id"]; this.templet = Context.Request["templet"]; this.pageNum = Context.Request["page_Num"]; //分页 page 参数 this.classs = Context.Request["class"]; //list页的分类编号参数 this.pageHost = Context.Request["host"]; //模板URL string templet_url = "~/" + config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost) + "/" + type + templet + ".html"; //读取 模板 StringBuilder HTM = new StringBuilder(); if (DataCache.GetCache(templet_url) == null) { try { if (SystemCms.Read_File(Context.Server.MapPath(templet_url), config.templet_language) == null) { //目录不存在创建 if (!Directory.Exists(Con.Server.MapPath("~/" + config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost) + "/"))) { Directory.CreateDirectory(Con.Server.MapPath("~/" + config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost) + "/")); } if (this.templet != null) { ROYcms.Sys.Model.ROYcms_template model = _BLL.GetModel(Convert.ToInt32(this.templet)); HTM.Append(model.htmlcontent); SystemCms.CreateFile(Con.Server.MapPath(templet_url), model.htmlcontent, config.templet_language); } else { HTM.Append("模板不存在!"); SystemCms.CreateFile(Con.Server.MapPath(templet_url), "ROYcms!NT 空模板,请编辑", config.templet_language); } } else { HTM.Append(SystemCms.Read_File(Context.Server.MapPath(templet_url), config.templet_language)); } DataCache.SetCache(templet_url, (object)SystemCms.Read_File(Context.Server.MapPath(templet_url), config.templet_language)); } catch { HTM.Append("读取模板异常!确定是否有创建文件的权限"); } } else { HTM.Append(DataCache.GetCache(templet_url).ToString()); } if (config.HTML_zip == "true") { return(SystemCms.ZipHtml(LoopClass(loopPage(ShowTag(LoopTag(PublicTag(HTM.ToString()))))))); } else { return(LoopClass(loopPage(ShowTag(LoopTag(PublicTag(HTM.ToString())))))); } }
/// <summary> /// 公共标签替换 /// </summary> /// <param name="template">模板内容</param> /// <returns></returns> /// <summary> private string PublicTag(string template) { //引入外部文件标签 Regex r = new Regex(@"(\[SG:File\s+Path=" + "\"" + @"(?<Path>[^" + "\"" + "]*)" + "\"" + @"\])", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (Match m in r.Matches(template)) { string Path = m.Groups["Path"].ToString(); template = template.Replace(m.Groups[0].Value.ToString(), SystemCms.Read_File(Context.Server.MapPath(config.templet_root + TemplateZone.TemplateZpath(this.pageHost) + "/" + Path), config.templet_language)); } //WEB.config 文件信息替换 template = Replace(template, @"\[SG:WebPath\]", config.web_host); template = Replace(template, @"\[SG:WebName\]", config.web_name); template = Replace(template, @"\[SG:TemplatePath\]", config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost)); //用户自定义标签替换 #region 对循环的内容进行替换 ROYcms.Sys.BLL.ROYcms_CustomTag bll = new ROYcms.Sys.BLL.ROYcms_CustomTag(); DataSet dt = bll.GetAllList(); if (dt.Tables[0].Rows.Count > 0) { int rowsCount = dt.Tables[0].Rows.Count; for (int n = 0; n < rowsCount; n++) { string str = template; str = str.Replace(@"[SG:" + dt.Tables[0].Rows[n]["TAG"].ToString().Trim() + "]", dt.Tables[0].Rows[n]["TAG_content"].ToString().Trim()); template = str; } } #endregion return(template); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //更新数据 ROYcms.Sys.Model.ROYcms_template Model_update = new ROYcms.Sys.Model.ROYcms_template(); if (Request["id"] != null) { Model_update.bh = Convert.ToInt32(Request["id"] == null ? "0" : Request["id"]); Model_update.name = TextBox_title.Text; Model_update.tag = TextBox_miaoshu.Text; Model_update.htmlcontent = TextBox_HTML.Text; Model_update.class_name = Request["type"]; Model_update.htmltimes = DateTime.Now; Model_update.y = 0; BLL.Update(Model_update); } //更新模板文件 try { string path = Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/" + Request["type"] + Request["id"] + ".html"); if (!Directory.Exists(Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/"))) { Directory.CreateDirectory(Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/")); } SystemCms.CreateFile(path, TextBox_HTML.Text, ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); ROYcms.Common.SystemCms.RemoveAllCache();//清除全局缓存 } catch { Response.Redirect("/administrator/Message.aspx?message=更新模板出错了!&z=no"); } Response.Redirect("/administrator/Message.aspx?message=更新模板成功!&z=yes"); }
/// <summary> /// 生成首页方法 无参数 News the HTML. /// </summary> /// <returns></returns> public bool NewHtml() { bool e = false; string templatepath = ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_file") + "/index.html"; //模版地址 string HTML = SystemCms.Read_File(HttpContext.Current.Server.MapPath(templatepath), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); string Path = "~/index.html"; //文件生成地址 using (StreamWriter sw = new StreamWriter(HttpContext.Current.Server.MapPath(Path), false, Encoding.GetEncoding(ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")))) { HTML = LoopTag(PublicTag(HTML)); //创建文件 try { sw.WriteLine(HTML); sw.Flush(); e = true; } catch (Exception ex) { HttpContext.Current.Response.Write(ex.Message); HttpContext.Current.Response.End(); e = false; } finally { sw.Close(); } return(e); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ROYcms.Sys.Model.ROYcms_template Model = new ROYcms.Sys.Model.ROYcms_template(); if (Request["id"] != null) { Model = BLL.GetModel(Convert.ToInt32(Request["id"] == null ? "0" : Request["id"])); TextBox_title.Text = Model.name; TextBox_miaoshu.Text = Model.tag; } else { TextBox_title.Visible = false; TextBox_miaoshu.Visible = false; Label1.Visible = false; Label2.Visible = false; Label_title.Text = "默认模板编辑"; Label_title_content.Text = "模板名 - " + Request["type"]; } try { TextBox_HTML.Text = SystemCms.Read_File(Server.MapPath(ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + Session["template_z_path"].ToString() + Request["type"] + Request["id"] + ".html"), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); } catch { TextBox_HTML.Text = Model.htmlcontent; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void add_Button_Click(object sender, EventArgs e) { if (BLL.Exists() == 0) { //插入数据 Model.name = TextBox_title.Text.Trim(); Model.z_id = Convert.ToInt32(Session["template_z_id"].ToString()); Model.tag = TextBox_miaoshu.Text.Trim(); Model.htmlcontent = TextBox_htmlContent.Text; Model.class_name = DropDownList_type.SelectedValue.Trim(); Model.htmltimes = DateTime.Now; Model.y = 0; //创建模板文件 try { string path = ""; path = Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/" + DropDownList_type.SelectedValue.Trim() + BLL.Add(Model) + ".html"); if (!Directory.Exists(Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/"))) { Directory.CreateDirectory(Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/")); } SystemCms.CreateFile(path, TextBox_htmlContent.Text, ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); } catch { Response.Redirect("/administrator/Message.aspx?message=创建模板出错了!&z=no"); } Response.Redirect("/administrator/Message.aspx?message=创建模板成功!&z=yes"); } else { //更新数据 Model.bh = BLL.Exists(); Model.z_id = Convert.ToInt32(Session["template_z_id"].ToString()); Model.name = TextBox_title.Text.Trim(); Model.tag = TextBox_miaoshu.Text.Trim(); Model.htmlcontent = TextBox_htmlContent.Text; Model.class_name = DropDownList_type.SelectedValue.Trim(); Model.htmltimes = DateTime.Now; Model.y = 0; //创建模板文件 try { string path = ""; path = Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/" + DropDownList_type.SelectedValue.Trim() + BLL.Exists().ToString() + ".html"); if (!Directory.Exists(Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/"))) { Directory.CreateDirectory(Server.MapPath("~/" + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + "/" + Session["template_z_path"].ToString() + "/")); } SystemCms.CreateFile(path, TextBox_htmlContent.Text, ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); BLL.Update(Model); } catch { Response.Redirect("/administrator/Message.aspx?message=创建模板出错了!&z=no"); } Response.Redirect("/administrator/Message.aspx?message=创建模板成功!&z=yes"); } }
/// <summary> /// 输出 /// </summary> /// <param name="output">The output.</param> protected override void Render(HtmlTextWriter output) { if (this.Path != null) { try { string htmlCONTENT = null; htmlCONTENT = SystemCms.Read_File(HttpContext.Current.Server.MapPath(this.Path), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); output.Write(htmlCONTENT); } catch { output.Write("<!--浏览信息记入数据库出错!-->"); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, EventArgs e) { if (path.Contains(":")) { SystemCms.CreateFile(this.path, TextBox_HTML.Text, ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); } else { SystemCms.CreateFile(Server.MapPath(path), TextBox_HTML.Text, ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); } Response.Redirect("/administrator/Message.aspx?message=更新成功!&z=yes"); }
/// <summary> /// /// </summary> /// <returns></returns> public string HTML() { string htmlCONTENT = null; if (path.Contains(":")) { htmlCONTENT = SystemCms.Read_File(this.path, ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); } else { htmlCONTENT = SystemCms.Read_File(Server.MapPath(this.path), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")); } return(htmlCONTENT); }
/// <summary> /// 公共标签替换Publics the tag. /// </summary> /// <param name="template">The template.</param> /// <returns></returns> public string PublicTag(string template) { if (template != null) { //引入外部文件标签 Regex r = new Regex(@"(\[SG:File\s+Path=" + "\"" + @"(?<Path>[^" + "\"" + "]*)" + "\"" + @"\])", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (Match m in r.Matches(template)) { string Path = m.Groups["Path"].ToString(); template = template.Replace(m.Groups[0].Value.ToString(), SystemCms.Read_File(HttpContext.Current.Server.MapPath(ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_file") + "/" + Path), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language"))); } //WEB.config 文件信息替换 template = Replace(template, @"\[SG:WebPath\]", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_host")); template = Replace(template, @"\[SG:WebName\]", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_name")); template = Replace(template, @"\[SG:WebDescription\]", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("Description")); template = Replace(template, @"\[SG:TemplatePath\]", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_root") + ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_file")); //用户自定义标签替换 #region 对循环的内容进行替换 ROYcms.Sys.BLL.ROYcms_CustomTag bll = new ROYcms.Sys.BLL.ROYcms_CustomTag(); DataSet dt = bll.GetAllList(); if (dt.Tables[0].Rows.Count > 0) { int rowsCount = dt.Tables[0].Rows.Count; for (int n = 0; n < rowsCount; n++) { string str = template; str = str.Replace(@"[SG:" + dt.Tables[0].Rows[n]["TAG"].ToString().Trim() + "]", dt.Tables[0].Rows[n]["TAG_content"].ToString().Trim()); template = str; } } #endregion } else { template = "<!--公共标签值为空!-->"; } return(template); }
/// <summary> /// 新闻子页面生成方法 News the HTML. /// </summary> /// <param name="Model">The model.</param> /// <returns></returns> public bool NewHtml(ROYcms.Sys.Model.ROYcms_class Model) { // StreamWriter sw = null;//定义参数 Model.FilePath = Model.FilePath.Replace("{cmspath}", "~"); string Path = ""; string templatepath = Model.TemplateShow;//模版地址 string SQL = null; if (this.bh != null) { SQL = "SELECT * FROM [ROYcms_news] " + " where bh=" + this.bh + ""; } else { SQL = "SELECT " + (this.top == null ? "" : "TOP " + this.top) + " * FROM [ROYcms_news] " + (this.star_id == null ? "" : " where bh>" + this.star_id) + (this.end_id == null ? "" : (this._star_id == null ? " where" : " and ") + " bh<" + this.end_id) + " ORDER BY bh desc"; } //写文件 try { DataSet ds = BLL.GetDataSet(SQL); DataTable dt = ds.Tables[0]; //读取模版 string Text = PublicTag(SystemCms.Read_File(HttpContext.Current.Server.MapPath(templatepath), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language"))); //列表标签过滤 Template.ROYcms_class_Model = Model;//全局赋值 Text = Template.LoopTag(Text); foreach (DataRow dr in dt.Rows) { Path = (Model.ShowRules.Contains("~/") ? Model.ShowRules : (Model.FilePath + Model.ShowRules));//文件生成地址 Path = Path.Replace("{yyyy}", Convert.ToDateTime(dr["time"]).ToString("yyyy")); Path = Path.Replace("{MM}", Convert.ToDateTime(dr["time"]).ToString("MM")); Path = Path.Replace("{dd}", Convert.ToDateTime(dr["time"]).ToString("dd")); Path = Path.Replace("{id}", dr["bh"].ToString()); string tempath = Path.Substring(0, Path.LastIndexOf("/") + 1); if (!Directory.Exists(HttpContext.Current.Server.MapPath(tempath))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(tempath)); } using (StreamWriter sw = new StreamWriter(HttpContext.Current.Server.MapPath(Path), false, Encoding.GetEncoding(ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")))) { try { //sw = new StreamWriter(HttpContext.Current.Server.MapPath(Path), false, Encoding.GetEncoding(config.templet_language)); string str = Text; str = Template.Replace(str, @"\[SG:Title\]", dr["title"].ToString()); str = Template.Replace(str, @"\[SG:Id\]", dr["bh"].ToString()); str = Template.Replace(str, @"\[SG:Url\]", dr["url"].ToString()); str = Template.Replace(str, @"\[SG:Pic\]", dr["pic"].ToString()); str = Template.Replace(str, @"\[SG:Zhaiyao\]", dr["zhaiyao"].ToString()); str = Template.Replace(str, @"\[SG:Keyword\]", dr["keyword"].ToString()); str = Template.Replace(str, @"\[SG:classname\]", dr["classname"].ToString()); str = Template.Replace(str, @"\[SG:Content\]", dr["contents"].ToString()); str = Template.Replace(str, @"\[SG:Infor\]", dr["infor"].ToString()); str = Template.Replace(str, @"\[SG:Author\]", dr["author"].ToString()); str = Template.Replace(str, @"\[SG:Tag\]", dr["tag"].ToString()); str = Template.Replace(str, @"\[SG:Dig\]", dr["dig"].ToString()); str = Template.Replace(str, @"\[SG:Hits\]", dr["hits"].ToString()); str = Template.Replace(str, @"\[SG:Time\]", dr["time"].ToString()); str = Template.Replace(str, @"\[SG:Year\]", Convert.ToDateTime(dr["time"]).ToString("yyyy")); str = Template.Replace(str, @"\[SG:Month\]", Convert.ToDateTime(dr["time"]).ToString("MM")); str = Template.Replace(str, @"\[SG:Day\]", Convert.ToDateTime(dr["time"]).ToString("dd")); // str = Template.Replace(str, @"\[SG:Day\]", Xml.GetValue(Convert.ToInt32(dr["bh"]), dr["type"].ToString(), "o")); sw.WriteLine(str); sw.Flush(); err = true; } catch (Exception ex) { HttpContext.Current.Response.Write(ex.Message); HttpContext.Current.Response.End(); err = false; } finally { sw.Close(); } } } } catch (Exception ex) { HttpContext.Current.Response.Write(ex.Message); HttpContext.Current.Response.End(); err = false; } return(err); }
/// <summary> /// 文章列表 频道 生成方法 循环标签的匹配替换 News the HTML. /// </summary> /// <param name="Model">The model.ROYcms_class 表对象</param> /// <returns></returns> public bool NewHtml(ROYcms.Sys.Model.ROYcms_class Model) { //定义参数 //StreamWriter sw = null; Model.FilePath = Model.FilePath.Replace("{cmspath}", "~"); string Path = ""; string ShowPath = ""; string templatepath = null; //模版地址 string HTML = ""; //模版内容 //最终列表栏目模式 if (Model.ColumnsType == 0) { templatepath = Model.TemplateList;//模版地址 // 生成默认页面开始 string TemplateIndexHTML = PublicTag(SystemCms.Read_File(HttpContext.Current.Server.MapPath(templatepath), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language"))); string TemplateIndexPath = (Model.FilePath + Model.DefaultFile); //文件生成地址 NewMain(TemplateIndexPath, TemplateIndexHTML); //生成默认页面结束 int onepage = (this.onepage == null ? 10 : Convert.ToInt32(this.onepage)); int Count = new ROYcms.Sys.BLL.ROYcms_news().GetCount((this.classname == null ? "" : " classname=" + this.classname)); int allpages = Count / onepage; string Text = ""; string AllText = ""; string content = ""; Regex r = new Regex(@"(\[SG:loop\s+(?<attributes>[^\]]*?)\](?<text>[\s\S]*?)\[/SG:loop\])", RegexOptions.Compiled | RegexOptions.IgnoreCase); for (int i = 0; i < (allpages < 1 ? 1 : allpages); i++) { HTML = PublicTag(SystemCms.Read_File(HttpContext.Current.Server.MapPath(templatepath), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language"))); Path = (Model.ListeRules.Contains("~/") ? Model.ListeRules : (Model.FilePath + Model.ListeRules));//文件生成地址 Path = Path.Replace("{page}", i.ToString()); ShowPath = Model.ShowRules; string tempath = Path.Substring(0, Path.LastIndexOf("/") + 1); if (!Directory.Exists(HttpContext.Current.Server.MapPath(tempath))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(tempath)); } int start = i * onepage; int nextpage = i + 1; int perpage = i - 1; if (nextpage == allpages) { nextpage = i; } if (perpage == -1) { perpage = 0; } string SQL = "SELECT TOP " + onepage + " * FROM [ROYcms_news] WHERE (bh NOT IN (SELECT TOP " + start + " bh FROM [ROYcms_news] " + (this.classname == null ? "" : " where classname=" + this.classname) + " ORDER BY bh desc ))" + (this.classname == null ? "" : " and classname=" + this.classname) + " ORDER BY bh desc "; DataSet ds = BLL.GetDataSet(SQL); DataTable dt = ds.Tables[0]; using (StreamWriter sw = new StreamWriter(HttpContext.Current.Server.MapPath(Path), false, Encoding.GetEncoding(ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language")))) { #region 对循环的内容进行替换 foreach (Match m in r.Matches(HTML)) { Text = m.Groups["text"].ToString(); //循环的内容不包含SG:Loop AllText = m.Groups[0].Value.ToString(); //整个匹配的内容包含SG:Loop foreach (DataRow dr in dt.Rows) { string str = Text; string T_ShowPath = ShowPath; str = Template.Replace(str, @"\[SG:Id\]", dr["bh"].ToString()); str = Template.Replace(str, @"\[SG:Title\]", dr["title"].ToString()); str = Template.Replace(str, @"\[SG:zhaiyao\]", dr["zhaiyao"].ToString()); str = Template.Replace(str, @"\[SG:pic\]", dr["pic"].ToString()); str = Template.Replace(str, @"\[SG:classname\]", dr["classname"].ToString()); str = Template.Replace(str, @"\[SG:author\]", dr["author"].ToString()); str = Template.Replace(str, @"\[SG:time\]", dr["time"].ToString()); str = Template.Replace(str, @"\[SG:Year\]", Convert.ToDateTime(dr["time"]).ToString("yyyy")); str = Template.Replace(str, @"\[SG:Month\]", Convert.ToDateTime(dr["time"]).ToString("MM")); str = Template.Replace(str, @"\[SG:Day\]", Convert.ToDateTime(dr["time"]).ToString("dd")); T_ShowPath = T_ShowPath.Replace("{yyyy}", Convert.ToDateTime(dr["time"]).ToString("yyyy")); T_ShowPath = T_ShowPath.Replace("{MM}", Convert.ToDateTime(dr["time"]).ToString("MM")); T_ShowPath = T_ShowPath.Replace("{dd}", Convert.ToDateTime(dr["time"]).ToString("dd")); T_ShowPath = T_ShowPath.Replace("{id}", dr["bh"].ToString()); str = Template.Replace(str, @"\[SG:Link\]", T_ShowPath); content += AllText.Replace(AllText, str); } HTML = HTML.Replace(AllText, content); HTML = HTML.Replace(@"[SG:PageUp]", Model.ListeRules.Replace("{page}", perpage.ToString())); HTML = HTML.Replace(@"[SG:PageDow]", Model.ListeRules.Replace("{page}", nextpage.ToString())); content = ""; } #endregion //创建文件 try { sw.WriteLine(HTML); sw.Flush(); err = true; } catch (Exception ex) { HttpContext.Current.Response.Write(ex.Message); HttpContext.Current.Response.End(); err = false; } finally { sw.Close(); } } } } //封面频道方式 if (Model.ColumnsType == 1) { templatepath = Model.TemplateIndex; //模版地址 HTML = PublicTag(SystemCms.Read_File(HttpContext.Current.Server.MapPath(templatepath), ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("templet_language"))); Path = (Model.FilePath + Model.DefaultFile); //文件生成地址 NewMain(Path, HTML); err = true; } return(err); }