示例#1
0
        /// <summary>
        /// 新闻热点、红人专访
        /// </summary>
        /// <param name="cid"></param>
        /// <returns></returns>
        private string Get_News_Hren(int cid)
        {
            sbr.Clear();

            ds = recommend_bll.GetList_NewIndex(8, " pageid=1000 and cid=" + cid + " ");

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];

                    string title = ArticleHelper.GetArticleTitle(dr["v2"].ToString());
                    title = StringHelper.ReturnNumStr(title, 2, 0);
                    string show_title = StringHelper.ReturnNumStr(title, 2, 18);
                    string desc       = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80);
                    string imgurl     = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString();
                    string httpurl    = String_Manage.Return_Str(dr["url"].ToString(), "");
                    //链接打开方式,1:在本页面打,2:在新页面打开
                    int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0);

                    string width_height = "height=\"130\" width=\"300\"";


                    sbr.AppendFormat("<li>");

                    if (openstyle != 1 && openstyle != 2)
                    {
                        sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">{1}", title, show_title);
                        sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height);
                        sbr.AppendFormat("</a>");
                    }
                    else
                    {
                        sbr.AppendFormat("<a {1} title=\"{0}\">{2}", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title);
                        sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height);
                        sbr.AppendFormat("</a>");
                    }

                    sbr.AppendFormat("</li>");
                }
            }

            return(sbr.ToString());
        }