Ejemplo n.º 1
0
        /// <summary>
        /// 返回频道下首页所有的文章列表URL地址
        /// </summary>
        ///  <param name="lang">频道分类</param>
        /// <param name="channelname">频道Name</param>
        /// <returns>返回频道下所有的文章列表URL地址</returns>
        private string GetArticleIndexUrlList(string lang, string channelname, string page, string pattern, string path, string querystring, int pagesize)
        {
            StringBuilder sburl     = new StringBuilder();
            int           strLength = 0;

            if (!string.IsNullOrEmpty(querystring))
            {
                strLength = querystring.Split('&').Length;
            }

            int totalCount = objarticle.GetCount(channelname, 0, 0, "");
            int pageindex  = GetPageSize(totalCount, pagesize);

            if (strLength == 1)
            {
                pageindex = 1;
            }
            for (int q = 1; q <= pageindex; q++)
            {
                string querystr    = Regex.Replace(string.Format(path, "0", q), pattern, querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                string linkurl     = string.Format("{0}/{1}/{2}?{3}", PLKeys.DIRECTORY_REWRITE_ASPX, lang, page, querystr);
                string HTMLPattern = string.Format("{0}/{1}/{2}", PLKeys.DIRECTORY_REWRITE_HTML, lang, Utils.GetUrlExtension(string.Format(path, "0", q), config.staticextension)); //替换扩展名
                if (!string.IsNullOrEmpty(sburl.ToString()))
                {
                    sburl.Append(",");
                }
                sburl.AppendFormat(urlstr, config.webpath, lang, linkurl.Replace("&", "^"), HTMLPattern);
            }

            return(sburl.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回频道下所有的文章列表URL地址
        /// </summary>
        ///  <param name="lang">频道分类</param>
        /// <param name="channelname">频道Name</param>
        /// <returns>返回频道下所有的文章列表URL地址</returns>
        private string GetArticleUrlList(string lang, string channelname, string page, string pattern, string path, string querystring, int pagesize)
        {
            StringBuilder sburl = new StringBuilder();
            DataTable     dt    = objarticle_category.GetList(0, channelname);

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int strLength = 0;
                    if (!string.IsNullOrEmpty(querystring))
                    {
                        strLength = querystring.Split('&').Length;
                    }

                    int totalCount = objarticle.GetCount(channelname, Convert.ToInt32(dt.Rows[i]["id"].ToString()), "");
                    int pageindex  = GetPageSize(totalCount, pagesize);
                    if (strLength == 1)
                    {
                        pageindex = 1;
                    }
                    for (int q = 1; q <= pageindex; q++)
                    {
                        string querystr    = Regex.Replace(string.Format(path, dt.Rows[i]["id"].ToString(), q), pattern, querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                        string linkurl     = string.Format("{0}/{1}/{2}?{3}", MXKeys.DIRECTORY_REWRITE_ASPX, lang, page, querystr);
                        string HTMLPattern = string.Format("{0}/{1}/{2}", MXKeys.DIRECTORY_REWRITE_HTML, lang, Utils.GetUrlExtension(string.Format(path, dt.Rows[i]["id"].ToString(), q), config.staticextension)); //替换扩展名
                        if (!string.IsNullOrEmpty(sburl.ToString()))
                        {
                            sburl.Append(",");
                        }
                        sburl.AppendFormat(urlstr, config.webpath, lang, linkurl.Replace("&", "^"), HTMLPattern);
                    }
                }
            }

            return(sburl.ToString());
        }