/// <summary> /// 显示模板 /// </summary> /// <param name="templatFileName">模板文件名</param> public void Display(string templateFile, NVelocityHelper th) { //全局 // th.Put(TagFields.QUERY_COUNT, querycount); //th.Put(TagFields.PROCESS_TIME, DateTime.Now.Subtract(starttick).TotalMilliseconds / 1000); // HttpContext.Current.Response.Clear(); // HttpContext.Current.Response.Write(writer.ToString()); HttpContext.Current.Response.Write(th.BuildString(templateFile)); // HttpContext.Current.Response.End(); }
/// <summary> /// 显示模板 /// </summary> /// <param name="templatFileName">模板文件名</param> public void Display(string templateFile, NVelocityHelper th) { //全局 // th.Put(TagFields.QUERY_COUNT, querycount); //th.Put(TagFields.PROCESS_TIME, DateTime.Now.Subtract(starttick).TotalMilliseconds / 1000); // HttpContext.Current.Response.Clear(); // HttpContext.Current.Response.Write(writer.ToString()); HttpContext.Current.Response.Write(th.BuildString(templateFile)); // HttpContext.Current.Response.End(); }
/// <summary> /// 显示模板 /// </summary> /// <param name="templatFileName">模板文件名</param> public static void Display(NVelocityHelper th, string templateFile) { //全局 th.Put("querycount", querycount); th.Put("processtime", DateTime.Now.Subtract(starttick).TotalMilliseconds / 1000); th.Put("sqlanalytical", SqlAnalytical); // HttpContext.Current.Response.Clear(); // HttpContext.Current.Response.Write(writer.ToString()); HttpContext.Current.Response.Write(th.BuildString(templateFile)); // HttpContext.Current.Response.End(); }
/// <summary> /// 初始化 /// </summary> void BlogInit(string action) { if (action == "feed") { templatePath = HttpContext.Current.Server.MapPath(ConfigHelper.SitePath + "common/config/"); } else { templatePath = HttpContext.Current.Server.MapPath(string.Format("{0}/themes/default/template/", ConfigHelper.SitePath)); } if (BlogConfig.GetSetting().SiteStatus == 0) { ResponseError("网站已关闭", "网站已关闭,请与站长联系!"); } pageindex = Framework.Web.PressRequest.GetQueryInt("page", 1); slug = Framework.Web.PressRequest.GetQueryString("slug"); UpdateViewCount();//更新访问量 //主题处理 _themeName = BlogConfig.GetSetting().Theme; string previewThemeName = Jqpress.Framework.Web.PressRequest.GetQueryString("theme", true); //if (Jqpress.Framework.Web.PressRequest.IsMobile) //{ // _themeName = BlogConfig.GetSetting().MobileTheme; //} if (!string.IsNullOrEmpty(previewThemeName)) { _themeName = previewThemeName; } //非预览时 if (!System.IO.Directory.Exists(templatePath) && string.IsNullOrEmpty(previewThemeName)) { BlogConfigInfo s = BlogConfig.GetSetting(); if (Jqpress.Framework.Web.PressRequest.IsMobile) { s.MobileTheme = "default"; } else { s.Theme = "default"; } _themeName = "default"; // BlogConfig.UpdateSetting(); templatePath = Server.MapPath(string.Format("{0}/themes/{1}/template/", ConfigHelper.SitePath, _themeName)); } if (action != "feed") { templatePath = Server.MapPath(string.Format("{0}/themes/{1}/template/", ConfigHelper.SitePath, _themeName)); } th = new NVelocityHelper(templatePath); }