public virtual string GetContent(string _ContentId) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_articleinfo] WHERE [Id]=" + _ContentId; DataTable dtSearch = _doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { dtSearch.Clear(); dtSearch.Dispose(); return("内容错误"); } SiteGroupCms.Dal.ArticleDal articledal = new ArticleDal(); SiteGroupCms.Entity.Article article = articledal.GetEntity(_ContentId); SiteGroupCms.Entity.Site site = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"]; TemplateEngineDAL te = new TemplateEngineDAL(article.Catalogid.ToString()); string PageStr = string.Empty; _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_articleinfo] WHERE [Id]=" + _ContentId; DataTable dtContent = _doh.GetDataTable(); string ChannelId = dtContent.Rows[0]["catalogid"].ToString(); te.PageNav = Go2Site() + " »" + Go2Channel(ChannelId, 0); te.PageTitle = site.WebTitle + "--" + dtContent.Rows[0]["title"].ToString(); te.PageKeywords = dtContent.Rows[0]["keywords"].ToString(); te.PageDescription = dtContent.Rows[0]["abstract"].ToString(); p__GetChannel_Article(te, dtContent, ref PageStr); //提取出模板的内容 te.ReplacePublicTag(ref PageStr); //包含include解析 siteconfig解析 已经注释掉了 replaceTag_ChannelLoop解析 //te.ReplaceChannelTag(ref PageStr, ChannelId); // PageStr = PageStr.Replace("{$channelid}",ChannelId); te.replaceTag_ChannelLoop(ref PageStr, ChannelId); //替换频道循环标签 te.ReplaceContentTag(ref PageStr, _ContentId); //解释单片文档的所有标签 te.ReplaceContentLoopTag(ref PageStr); // te.ReplaceChannelTag(ref PageStr, ChannelId); //替换 te.ExcuteLastHTML(ref PageStr); //替换注释标签 PageStr = SiteGroupCms.Utils.Strings.UBB2HTML(PageStr); //替换ubb标签 return(PageStr.Replace("{$Content}", dtContent.Rows[0]["content"].ToString())); // .Replace("{$_getPageBar()}", getPageBar(1, "html", 7, ContentList.Count - 1, 1, _CurrentPage, Go2View(true, _ChannelId, _ContentId, false), Go2View(true, _ChannelId, _ContentId, false), Go2View((true), _ChannelId, _ContentId, false), 0)); } }
private void p__GetPage(TemplateEngineDAL te, DataTable dt, ref string PageStr, ref System.Collections.ArrayList ContentList, int i) { string TempId = string.Empty; string CurrentCategoryId = dt.Rows[i]["CategoryId"].ToString(); string ParentCategoryId = string.Empty; string TopCategoryId = string.Empty; string LanguageCode = string.Empty; using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "[Id]=" + dt.Rows[i]["CategoryId"].ToString(); object[] value = _doh.GetFields(base.CategoryTable, "ContentTemp,ParentId,TopId,LanguageCode"); TempId = value[0].ToString(); ParentCategoryId = value[1].ToString(); TopCategoryId = value[2].ToString(); LanguageCode = value[3].ToString().ToLower(); } //得到模板内容 new JumboECMS.DAL.Normal_TemplateDAL().GetTemplateContent(TempId, ref PageStr); te.PageNav = te.GetCategoryNavigateHTML(CurrentCategoryId); te.PageTitle = dt.Rows[i]["Title"] + "_" + te.GetCategoryNavigateTitle(CurrentCategoryId); if (LanguageCode == "cn") { te.PageKeywords = JumboECMS.Utils.WordSpliter.GetKeyword(dt.Rows[i]["Title"].ToString()) + "," + site.Keywords1; } else { te.PageKeywords = JumboECMS.Utils.WordSpliter.GetKeyword(dt.Rows[i]["Title"].ToString()) + "," + site.Keywords2; } te.PageDescription = JumboECMS.Utils.Strings.SimpleLineSummary(dt.Rows[i]["Summary"].ToString()); te.ReplacePublicTag(ref PageStr); PageStr = PageStr.Replace("{$CurrentCategoryId}", CurrentCategoryId); PageStr = PageStr.Replace("{$ParentCategoryId}", ParentCategoryId); PageStr = PageStr.Replace("{$TopCategoryId}", TopCategoryId); te.ReplaceCategoryLoopTag(ref PageStr); te.ReplaceCategoryTag(ref PageStr, CurrentCategoryId); //te.ReplaceContentLoopTag(ref PageStr); }