/// <summary> /// 获取当前栏目对象 /// </summary> /// <returns>当前栏目</returns> protected Channel GetThisChannel() { string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); return(ch); }
/// <summary> /// 获得当前栏目下的第一篇文章 /// </summary> /// <returns></returns> protected Article GetThisArticle() { string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); Criteria c = new Criteria(CriteriaType.Equals, "ChannelFullUrl", ch.FullUrl); c.Add(CriteriaType.Equals, "State", 1); Order[] os = new Order[] { new Order("Updated", OrderMode.Desc) }; List <Article> aList = Assistant.List <Article>(c, os, 0, 1, new string[] { "ID", "Title", "ChannelFullUrl", "Created", "SN" }); if (aList != null && aList.Count > 0) { return(aList[0]); } else { return(new Article()); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (string.IsNullOrEmpty(OwnerID)) { OwnerID = ChannelHelper.GetChannelIDFromURL(); } }
/// <summary> /// 获取当前栏目对象 /// </summary> /// <returns>当前栏目</returns> protected Channel GetThisChannel() { if (DesignHelper.IsDesigning && DesignRecords.Count > 0) { return(DesignRecords[0]); } string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); return(ch); }
private string GetAll() { string result = ""; string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); InitChannels(ch); for (int i = lsChannels.Count - 1; i >= 0; i--) { result += getChannelTree(lsChannels[i].ID); } return(result); }
protected override Criteria CreateCriteria() { Criteria c = new Criteria(); List <Order> os = new List <Order>(); os.Add(new Order("ID")); if (QueryByColumn) //按栏目查询 { if (String.IsNullOrEmpty(OwnerID)) { OwnerID = ChannelHelper.GetChannelIDFromURL(); } if (IncludeChildren) //按子栏目查询 { Criteria subC = new Criteria(); subC.Mode = CriteriaMode.Or; subC.Add(CriteriaType.Equals, "OwnerID", OwnerID); List <Channel> chs = ChannelHelper.GetChannels(OwnerID); if (chs != null && chs.Count > 0) { foreach (Channel ch in chs) { c.AddOr(CriteriaType.Equals, "OwnerID", ch.ID); } } } else { c.Add(CriteriaType.Equals, "OwnerID", OwnerID); } } if (ShowAtHome) //只显示置顶信息 { c.Add(CriteriaType.Equals, "IsShow", 1); } if (!String.IsNullOrEmpty(Tag)) //按标签查询 { c.Add(CriteriaType.Like, "Tags", "%'" + Tag + "'%"); } c.Add(CriteriaType.Equals, "State", 1); //只显示状态为可用的数据 ProcessQueryParam(c); //处理附加查询数据 return(c); }
protected void Initialize() { bool enableCache = (CDHelper.Config.EnableCache == "true"); string result = ""; string curUrl = Context.Request.Path.Replace('/', '_'); result = ChannelHelper.GetChannelIDFromURL(); ColumnID = result; //初始化ArticleID result = ArticleHelper.GetArticleIDFromURL(); ArticleID = result; //初始化ColumnMode result = GetColumnMode(); ColumnMode = result; //初始化ThisChannel Channel ch = null; if (ColumnID != null && ColumnID != "") { ch = ChannelHelper.GetChannel(ColumnID, null); } else if (ColumnAlias != null) { ch = ChannelHelper.GetChannelByAlias(ColumnAlias); } else { ch = null; } ThisChannel = ch; //初始化TemplatePath result = TemplateHelper.GetThisPageTemplate(ColumnMode, ColumnID, SearchWord, SeSearchWord); if (result != null) { if (!result.StartsWith("/")) { TemplatePath = "/" + result; } else { TemplatePath = result; } } }
/// <summary> /// 获取广告位的JS文件路径 /// </summary> /// <param name="siteID">站点ID</param> /// <param name="url">站点Url</param> /// <param name="tag">页面标签</param> /// <returns></returns> public string GetADZoneJSPath(string siteID, string url, string app, string tag) { try { ChannelHelper chHelper = HelperFactory.GetHelper <ChannelHelper>(); url = url.ToLower(); string chID = chHelper.GetChannelIDFromURL(); string channelPath = chHelper.GetFullPath(chID); string pathType = ""; //路径类型:"*"首页与栏目;"*.html"内容页;"*.aspx"其他页 if ((url.EndsWith("_") && !url.EndsWith("aspx_")) || url.EndsWith("_default.aspx") || url.EndsWith("_default.html") || url.EndsWith("_index.html")) { pathType = "*"; } if (url.EndsWith(".html") && !url.EndsWith("default.html")) { pathType = "*.html"; } if ((url.EndsWith(".aspx") && !url.EndsWith("default.aspx")) || url.EndsWith(".aspx_")) { pathType = "*.aspx"; channelPath = "";//如果为其他页,则此路径为空 } return(GetADService().GetAdZoneJSPath(siteID, channelPath, pathType, tag)); } catch (SoapException soapExt) { throw new Exception(We7Helper.SoapExceptionInfo(soapExt)); } catch (Exception ex) { throw ex; } }
protected override void Initialize() { ColumnID = ChannelHelper.GetChannelIDFromURL(); //初始化ThisChannel if (ThisChannel != null) { if (ThisChannel.Type == ((int)TypeOfChannel.ReturnChannel).ToString() && !string.IsNullOrEmpty(ThisChannel.ReturnUrl)) { //跳转类型进行跳转 Response.Redirect(ThisChannel.ReturnUrl, true); } } //初始化TemplatePath string result = IsHtmlTemplate ? TemplateHelper.GetHtmlTemplateByHandlers(ColumnMode, ColumnID, SearchWord, "") : TemplateHelper.GetTemplateByHandlers(ColumnMode, ColumnID, SearchWord, null); if (!string.IsNullOrEmpty(result)) { if (!result.StartsWith("/")) { TemplatePath = "/" + result; } else { TemplatePath = result; } } if (!string.IsNullOrEmpty(TemplatePath)) { if (File.Exists(Context.Server.MapPath(TemplatePath))) { // Control ctl = LoadControl(TemplatePath); Control ctl = CheckControlByBuilder(); if (ctl != null) { this.Controls.Add(ctl); if (this.Page.Header != null && this.Title != null) { this.Title = GetCurrentPageTitle(ColumnID, ""); //meta标记 HtmlGenericControl KeywordsMeta = new HtmlGenericControl("meta"); KeywordsMeta.Attributes["name"] = "keywords"; string strContent = ""; if (ThisChannel != null && ThisChannel.KeyWord != null && ThisChannel.KeyWord.Length > 0) { strContent = ThisChannel.KeyWord; } else { strContent = GeneralConfigs.GetConfig().KeywordPageMeta; } KeywordsMeta.Attributes["content"] = strContent; this.Header.Controls.Add(KeywordsMeta); HtmlGenericControl DescriptionMeta = new HtmlGenericControl("meta"); DescriptionMeta.Attributes["name"] = "description"; string strDescriptionMetaContent = ""; if (ThisChannel != null && ThisChannel.DescriptionKey != null && ThisChannel.DescriptionKey.Length > 0) { strDescriptionMetaContent = ThisChannel.DescriptionKey; } else { strDescriptionMetaContent = GeneralConfigs.GetConfig().DescriptionPageMeta; } DescriptionMeta.Attributes["content"] = strDescriptionMetaContent; this.Header.Controls.Add(DescriptionMeta); } } } else { Server.Transfer(TemplateGuideUrl, true); } } else { Server.Transfer(TemplateGuideUrl, true); } }
protected override void Initialize() { columnID = ChannelHelper.GetChannelIDFromURL(); articleID = ArticleHelper.GetArticleIDFromURL(); AddClicks(articleID); //点击量统计 AddStatistic(articleID, columnID); //初始化TemplatePath string templatePath = IsHtmlTemplate? TemplateHelper.GetHtmlTemplateByHandlers("detail", columnID, null, null) :TemplateHelper.GetTemplateByHandlers("detail", columnID, null, null); TemplatePath = templatePath; if (!string.IsNullOrEmpty(templatePath)) { if (!templatePath.StartsWith("/")) { templatePath = "/" + templatePath; } if (File.Exists(Context.Server.MapPath(templatePath))) { Control ctl = CheckControlByBuilder(); this.Controls.Add(ctl); if (ctl != null) { if (this.Page.Header != null && this.Title != null) { this.Title = GetCurrentPageTitle(columnID, articleID); Article thisArticle = ArticleHelper.GetArticle(articleID); //meta标记 HtmlGenericControl KeywordsMeta = new HtmlGenericControl("meta"); KeywordsMeta.Attributes["name"] = "keywords"; KeywordsMeta.Attributes["content"] = (thisArticle != null && !String.IsNullOrEmpty(thisArticle.KeyWord) && thisArticle.KeyWord.Length > 0) ? thisArticle.KeyWord : CDHelper.Config.KeywordPageMeta; this.Header.Controls.Add(KeywordsMeta); HtmlGenericControl DescriptionMeta = new HtmlGenericControl("meta"); DescriptionMeta.Attributes["name"] = "description"; if (thisArticle != null && string.IsNullOrEmpty(thisArticle.DescriptionKey)) { thisArticle.DescriptionKey = thisArticle.Summary; } DescriptionMeta.Attributes["content"] = (thisArticle != null && !String.IsNullOrEmpty(thisArticle.DescriptionKey) && thisArticle.DescriptionKey.Length > 0) ? thisArticle.DescriptionKey : CDHelper.Config.DescriptionPageMeta; this.Header.Controls.Add(DescriptionMeta); //加载点击量统计js文件 AddJavascriptFile2Header("/Scripts/jQuery/jquery-1.4.2.js"); AddJavascriptFile2Header("/admin/ajax/ClickRecord.js"); } } } else { Server.Transfer(TemplateGuideUrl, true); } } else { Server.Transfer(TemplateGuideUrl, true); } }