public override string GetContent(string _moduletype, string _contentid, int _page) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT [CategoryId] FROM [jcms_module_" + _moduletype + "] WHERE [IsPass]=1 and [Id]=" + _contentid; DataTable dtSearch = _doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { dtSearch.Clear(); dtSearch.Dispose(); return("内容错误"); } string ClassId = dtSearch.Rows[0]["CategoryId"].ToString(); dtSearch.Clear(); dtSearch.Dispose(); TemplateEngineDAL te = new TemplateEngineDAL(); _doh.Reset(); _doh.SqlCmd = "SELECT Id FROM [" + base.CategoryTable + "] WHERE [Id]=" + ClassId; if (_doh.GetDataTable().Rows.Count == 0) { return("栏目错误"); } string PageStr = string.Empty; _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [jcms_module_" + _moduletype + "] WHERE [IsPass]=1 and [Id]=" + _contentid; DataTable dtContent = _doh.GetDataTable(); string _FirstPage = dtContent.Rows[0]["FirstPage"].ToString(); System.Collections.ArrayList ContentList = new System.Collections.ArrayList(); p__GetPage(te, dtContent, ref PageStr, ref ContentList, 0); te.ReplaceContentTag("video", ref PageStr, _contentid); te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联 ContentList.Add(PageStr); p__replaceSingleVideo(dtContent, ref _page, ref PageStr, ref ContentList); int _TotalPage = Convert.ToInt16(ContentList[1].ToString());//总页数 dtContent.Clear(); dtContent.Dispose(); string _PrevLink = _page == 1 ? "#" : Go2View(_moduletype, _contentid, _page - 1); string _NextLink = _page == _TotalPage ? "#" : Go2View(_moduletype, _contentid, _page + 1); string _html = ContentList[0].ToString(); string[] ThisVideoUrl = ContentList[2].ToString().Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries); //string CurrentVideoUrl = ThisVideoUrl[ThisVideoUrl.Length - 1]; string CurrentVideoUrl = site.Dir + "plus/video_play.aspx?Id=" + _contentid + "&NO=" + (_page - 1); string CurrentVideoTitle = ThisVideoUrl.Length == 1 ? "" : ThisVideoUrl[0]; return(_html .Replace("{$CurrentPage}", _page.ToString()) .Replace("{$TotalPage}", ContentList[1].ToString()) .Replace("{$CurrentVideoUrl}", CurrentVideoUrl) .Replace("{$CurrentVideoTitle}", CurrentVideoTitle) .Replace("{$SlideJSON}", ContentList[3].ToString()) .Replace("{$PrevLink}", _PrevLink) .Replace("{$NextLink}", _NextLink)); } }
private void p__GetChannel_Article(TemplateEngineDAL te, DataTable dt, ref string PageStr) { string TempId, ClassName; using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "id=" + dt.Rows[0]["catalogid"].ToString(); TempId = _doh.GetField("yy_cataloginfo", "contenttemplate").ToString(); ClassName = _doh.GetField("yy_cataloginfo", "Title").ToString(); } string pId = string.Empty; //得到模板方案组ID/主题ID/模板内容 new SiteGroupCms.Dal.Normal_TemplateDAL().GetTemplateContent(TempId, ref PageStr); //te.ReplaceContentLoopTag(ref PageStr);//先不要解析 }
public virtual string GetContent(string _moduletype, string _contentid, int _page) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT [CategoryId] FROM [jcms_module_" + _moduletype + "] WHERE [IsPass]=1 and [Id]=" + _contentid; DataTable dtSearch = _doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { dtSearch.Clear(); dtSearch.Dispose(); return("内容错误"); } string ClassId = dtSearch.Rows[0]["CategoryId"].ToString(); dtSearch.Clear(); dtSearch.Dispose(); TemplateEngineDAL te = new TemplateEngineDAL(); _doh.Reset(); _doh.SqlCmd = "SELECT Id FROM [" + base.CategoryTable + "] WHERE [Id]=" + ClassId; if (_doh.GetDataTable().Rows.Count == 0) { return("栏目错误"); } string PageStr = string.Empty; _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [jcms_module_" + _moduletype + "] WHERE [IsPass]=1 and [Id]=" + _contentid; DataTable dtContent = _doh.GetDataTable(); string _FirstPage = dtContent.Rows[0]["FirstPage"].ToString(); System.Collections.ArrayList ContentList = new System.Collections.ArrayList(); p__GetPage(te, dtContent, ref PageStr, ref ContentList, 0); te.ReplaceContentTag("news", ref PageStr, _contentid); te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联 ContentList.Add(PageStr); p__replaceSingleArticle(dtContent, ref _page, ref PageStr, ref ContentList); dtContent.Clear(); dtContent.Dispose(); return(ContentList[0].ToString()); } }
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); }