Exemplo n.º 1
0
    /// <summary>
    /// 显示热词
    /// </summary>
    /// <returns></returns>
    public static string ShowHotWords()
    {
        int             count   = 0;
        string          format  = "<a href='UrlRouter.aspx?type=Search&keywords={0}'>{1}</a>";
        string          result  = "";
        SiteSettingInfo setting = new TMS.SiteSetting().Select(1);

        if (setting != null)
        {
            string[] arr = setting.HotSearchWords.Split('|');
            for (int i = 0; i < arr.Length; i++)
            {
                if (!arr[i].IsNullOrEmpty())
                {
                    result += string.Format(format, HttpContext.Current.Server.UrlEncode(arr[i]), arr[i]);
                    count   = count + 1;
                }
                if (count >= 10)
                {
                    break;
                }
            }
        }

        return(result);
    }