/// <summary> /// 获取 CmsChannel 对象的 URL 属性 /// </summary> /// <param name="cmsPosting">CmsPosting 对象</param> /// <returns></returns> public string GetChannelUrl(MCMS.PAPI.CmsChannel cmsChannel) { return cmsChannel.Path.ToLower().Replace("/channels", ""); }
/// <summary> /// 获取 CmsPosting 对象的 URL 属性,如果使用的是Stage状态的时候,将附加Stage服务器的地址 /// </summary> /// <param name="cmsPosting">CmsPosting 对象</param> /// <returns></returns> public string GetPostingUrl(MCMS.PAPI.CmsPosting cmsPosting) { if ((NeedStage())&&(this.IsStaging)) { return PageSiteUtil.GetStageVirtualPath()+PageSiteUtil.GetPostingsPath(cmsPosting); } else { return PageSiteUtil.GetPostingsPath(cmsPosting); } }
/// <summary> /// 分页获取指定栏目下文章列表 /// </summary> /// <param name="cmsChannel">要获取的栏目</param> /// <param name="isCheckItsChildChannel">是否获取其子栏目文章</param> /// <param name="currentPage">当前页,从1开始计数</param> /// <param name="pageSize">每页的文章数</param> /// <returns></returns> public IList<MCMS.PAPI.CmsPosting> GetPostingsOfPage(MCMS.PAPI.CmsChannel cmsChannel, bool isCheckItsChildChannel, int currentPage, int pageSize) { if (isCheckItsChildChannel) { return cmsChannel.GetAllPostingsOfPage(currentPage, pageSize); } else { return cmsChannel.GetPostingsOfPage(currentPage, pageSize); } }
/// <summary> /// 从 PAPI 取得按“置顶->日期->优先级”进行排序的 Postings 集合 /// </summary> /// <param name="cmsChannel">频道对象</param> /// <param name="isCheckItsChildChannel">是否检查 cmsChannel 的子频道</param> /// <returns></returns> public IList<MCMS.PAPI.CmsPosting> GetPostingsByDefaultFromPAPI(MCMS.PAPI.CmsChannel cmsChannel, bool isCheckItsChildChannel) { return PageSiteUtil.GetPostingsByDefaultFromPAPI(cmsChannel, isCheckItsChildChannel); }
/// <summary> /// 获取 CmsPosting 的 Path 属性 /// </summary> /// <param name="cmsPosting">CmsPosting 对象</param> /// <returns></returns> public static string GetPostingsPath( MCMS.PAPI.CmsPosting cmsPosting ) { return cmsPosting.Path.ToLower().Replace( "/channels" , "" ) + ".htm"; }
/// <summary> /// 从 PAPI 取得按“置顶->日期->优先级”进行排序的 Postings 集合 /// </summary> /// <param name="cmsChannel">频道对象</param> /// <param name="isCheckItsChildChannel">是否检查 cmsChannel 的子频道</param> /// <returns></returns> public static IList<MCMS.PAPI.CmsPosting> GetPostingsByDefaultFromPAPI( MCMS.PAPI.CmsChannel cmsChannel , bool isCheckItsChildChannel ) { IList<MCMS.PAPI.CmsPosting> postings; if ( isCheckItsChildChannel ) { postings = cmsChannel.AllPostingsSortByPublishedDatePRI; } else { postings = cmsChannel.PostingsSortByPublishedDatePRI; } return postings; }