Web/kzcms/core/_Search.aspx.cs

(完整代码) 2KB

using System;
using System.IO;
using Kscor.TemplateEngine;

namespace Web.core
{
    public partial class _Search : System.Web.UI.Page
    {
        private VelocityHelper vh = null;
        private int PageIndex = 0;
        private string templatePath = "", themeurl = "", Keyword = "";
        private Kscor.Model.Config ModelConfig = new Kscor.BLL.Config().GetMaxModel();
        protected void Page_Load(object sender, EventArgs e)
        {
            string CookieTheme = Kscor.Common.CookieHelper.GetCookieValue("Theme");
            if (ModelConfig == null)
            {
                Response.Write("系统配置出错");
            }
            else
            {
                string MyTheme = CookieTheme == "" ? ModelConfig.Theme : CookieTheme;
                themeurl = string.Format("/kzcms/themes/{0}/", MyTheme);
                templatePath = Server.MapPath(themeurl);
                if (!Directory.Exists(templatePath))
                {
                    Response.Write(string.Format("主题{0}不存在!", MyTheme));
                }
                else
                {
                    vh = new VelocityHelper(templatePath);
                    vh.themeurl = themeurl;
                    vh.ModelConfig = ModelConfig;
                    vh.LoadCommon();
                    LoadSearch();
                }
            }
        }

        public void LoadSearch()
        {
            Keyword = RouteData.Values["Keyword"] == null ? "" : RouteData.Values["Keyword"].ToString();
            PageIndex = RouteData.Values["Page"] == null ? 0 : Convert.ToInt32(RouteData.Values["Page"]);
            PageIndex = PageIndex == 0 ? Kscor.Common.DNTRequest.GetInt("PageIndex", 0) : PageIndex;
            Keyword = Keyword == "" ? Kscor.Common.DNTRequest.GetString("Keyword") : Keyword;
            vh.Put("pagetype", "search");
            vh.Put("keyword", Keyword);
            vh.Put("page", PageIndex);
            vh.Put("title", string.Format("{0}-{1}", Keyword, this.ModelConfig.SeoTitle));
            vh.Put("keywords", Keyword);
            vh.Put("description", this.ModelConfig.SeoDescription);
            vh.Display("search.html");
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。