/// <summary> /// 输出最终的html /// </summary> /// <param name="templateFileName"></param> /// <param name="tPath"></param> /// <param name="wid"></param> public void OutPutHtml(string templateFileName, int wid) { //注册一个自定义函数 this.Document.RegisterGlobalFunction(this.GetNewsUrl); //对VT模板里的config变量赋值 Model.wxcodeconfig wxconfig = tDal.GetModelByWid(wid, "/templates/index/" + templateFileName); //if (wxconfig == null || wxconfig.sitename.Trim() == "") //{1e2124dd04e11d01b9df2865f85944be // HttpContext.Current.Response.Write("请填写【微网站设置】相关信息"); //} //else if (wxconfig.wxstatus == 0) { HttpContext.Current.Response.Write("帐号已过期!请及时充值!"); } this.Document.Variables.SetValue("config", wxconfig); //获得幻灯片列表方法一:缺点无法从模版页面控制记录数量 this.Document.Variables.SetValue("photo", tDal.GetHDPByWid(wid, -1)); this.Document.SetValue("wid", wid); this.Document.SetValue("bottomtype", wxconfig.bmenuTid); this.Document.SetValue("ccright", ccRight); this.Document.SetValue("thisurl", MyCommFun.getTotalUrl()); this.Document.SetValue("yuming", MyCommFun.getWebSite()); string openid = MyCommFun.RequestOpenid(); this.Document.SetValue("openid", openid); this.Document.Variables.SetValue("this", this); if (tType == TemplateType.Index) { //如果为首页页面 this.Document.SetValue("fxTitle", wxconfig.sitename); this.Document.SetValue("fxDesc", wxconfig.wbrief); this.Document.SetValue("fxPic", MyCommFun.ImgAddHttp(wxconfig.bgpic)); } if (tType == TemplateType.Class) { //如果为列表页面 ArticleClassPage(); } if (tType == TemplateType.News) { ArticleDetailPage(); } if (tType == TemplateType.Channel) { CategoryPage(); } //输出最终呈现的数据 this.Document.Render(HttpContext.Current.Response.Output); }
/// <summary> /// 获得版权信息 /// </summary> /// <param name="wid"></param> /// <returns></returns> public string getwebcopyright(int wid) { wsiteBll wBll = new wsiteBll(); Model.wxcodeconfig config = wBll.GetModelByWid(wid, ""); if (config != null) { return(config.wcopyright); } else { return(""); } }
/// <summary> /// 输出最终的html /// </summary> /// <param name="templateFileName"></param> /// <param name="tPath"></param> /// <param name="wid"></param> public void OutPutHtml(int wid) { //注册一个自定义函数 this.Document.RegisterGlobalFunction(this.ComputeMoney); //对VT模板里的config变量赋值 Model.wxcodeconfig wxconfig = tDal.GetModelByWid(wid, tPath); if (wxconfig.wxstatus == 0) { HttpContext.Current.Response.Write("帐号已过期!请及时充值!"); } this.Document.Variables.SetValue("config", wxconfig); BLL.wx_shop_setting setBll = new BLL.wx_shop_setting(); if (!setBll.ExistsWid(wid)) { HttpContext.Current.Response.Write("请先选择模版!"); HttpContext.Current.Response.End(); } Model.wx_shop_setting setting = setBll.GetModelList("wid=" + wid)[0]; this.Document.Variables.SetValue("shopconfig", setting); this.Document.SetValue("wid", wid); this.Document.SetValue("ccright", ccRight); this.Document.SetValue("yuming", MyCommFun.getWebSite()); this.Document.SetValue("thisurl", MyCommFun.getTotalUrl()); this.Document.SetValue("indexurl", indexUrl()); this.Document.SetValue("categoryurl", MyCommFun.urlAddOpenid("/shop/category.aspx?wid=" + wid, openid)); this.Document.SetValue("carturl", "/shop/cart.aspx?wid=" + wid); this.Document.SetValue("userurl", "/shop/userinfo.aspx?wid=" + wid); this.Document.SetValue("openid", openid); this.Document.Variables.SetValue("this", this); if (tType == TemplateType.Class) { ProductClassPage(); } else if (tType == TemplateType.News) { ShopDetailPage(); } else if (tType == TemplateType.Cart) { CartDetailPage(); } else if (tType == TemplateType.confirmOrder) { confirmOrder(); } else if (tType == TemplateType.editaddr) { editAddrPage(); } else if (tType == TemplateType.orderSuccess) { OrderSuccessPage(); } else if (tType == TemplateType.userinfo) { userinfoPage(); } else if (tType == TemplateType.orderDetail) { //订单详情页面 orderDetail(); } //输出最终呈现的数据 this.Document.Render(HttpContext.Current.Response.Output); }