Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
        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());
            }
        }
Beispiel #3
0
 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));
     }
 }