/// <summary> /// 创建默认Html标签 /// </summary> /// <param name="_d"></param> /// <returns></returns> private string CreateDefaultHtmlTag(List<Dictionary<string, string>> _d) { //样式 var _css = this.CreateStylesheet(); var url = System.Web.HttpContext.Current.Request.Url; var host = "http://" + url.Authority; var _redirect = string.IsNullOrEmpty(this.RedirectUrl) ? host : this.RedirectUrl; var _result = string.Empty; if (_d.Count > 0) { _result = string.IsNullOrEmpty(_css) ? "<ul" + _css + ">" : "<ul" + _css; foreach (var item in _d) { _result += "<li><a href=\"" + _redirect + "/" + item["path"] + "\">" + item["rename"] + "</a></li>"; } _result += "</ul>"; } else { _result = "数据读取失败或数据不存在"; } return _result; }
/// <summary> /// /// </summary> /// <param name="_templet"></param> /// <param name="_d"></param> /// <returns></returns> private string CreateNormalHtml(string _templet, List<Dictionary<string, string>> _d) { var _result = string.Empty; var _width = this.width; var _height = this.height; if (_width == 0 || _height == 0) { if (_width == 0) { _width = 120; } if (_height == 0) { _height = 80; } } if (!string.IsNullOrEmpty(_templet)) { _result = this.ReplaceTemplet(_templet, _d); } else { if (_d.Count > 0) { foreach (var item in _d) { _result += "<img src=\"" + item["savename"] + "\" width=\"" + _width + "\" height=\"" + _height + "\"" + "/>"; } } } return _result; }
/// <summary> /// /// </summary> /// <param name="_templet"></param> /// <param name="_d"></param> /// <returns></returns> private string CreateCoupletHtml(string _templet, List<Dictionary<string, string>> _d) { var _result = string.Empty; var _width = this.width; var _height = this.height; if (_width == 0 || _height == 0) { if (_width == 0) { _width = 120; } if (_height == 0) { _height = 80; } } if (!string.IsNullOrEmpty(_templet)) { _result = this.ReplaceTemplet(_templet, _d); } else { _iscouplet = true; _result += "<script type=\"text/javascript\">"; _result += "var theFloaters = new floaters();"; if (_d.Count > 0) { foreach (var item in _d) { if (Convert.ToInt32(item["id"]) == this.leftId) { _result += "theFloaters.addItem('followDiv1', \"document.body.clientWidth-250\"," + _width + ",'<a style=\"display:block;\" href=\"\" target=\"_blank\"><img src=\"/91.com/Public/Uploads/5425458d0ce66.jpg\" width=\"" + _width + "\" height=\"120\" border=\"0\"></a>');"; } else { _result += "theFloaters.addItem(\"followDiv2\", 20, " + _width + ", '<a style=\"display:block;\" href=\"http://\" target=\"_blank\"><img src=\"/91.com/Public/Uploads/5425457ac8f96.jpg\" width=\"" + _width + "\" height=\"120\" border=\"0\"></a>');"; } } } else { _result += "theFloaters.addItem('followDiv1', \"document.body.clientWidth-" + _width + "\"," + _width + ",'<a style=\"display:block;\" href=\"\" target=\"_blank\"><img src=\"/91.com/Public/Uploads/5425458d0ce66.jpg\" width=\"" + _width + "\" height=\"120\" border=\"0\"></a>');"; _result += "theFloaters.addItem(\"followDiv2\", 20, " + _width + ", '<a style=\"display:block;\" href=\"http://\" target=\"_blank\"><img src=\"/91.com/Public/Uploads/5425457ac8f96.jpg\" width=\"" + _width + "\" height=\"120\" border=\"0\"></a>');"; } } _result += "theFloaters.play();"; _result += "</script>"; return _result; }
/// <summary> /// 创建漂浮广告 /// </summary> /// <param name="_templet"></param> /// <param name="_d"></param> /// <returns></returns> private string CreateFloatHtml(string _templet, List<Dictionary<string, string>> _d) { var _result = string.Empty; var _width = this.width; var _height = this.height; if (_width == 0 || _height == 0) { if (_width == 0) { _width = 220; } if (_height == 0) { _height = 100; } } if (!string.IsNullOrEmpty(_templet)) { _result = this.ReplaceTemplet(_templet, _d); } else { _isfloat = true; _result += "<script type=\"text/javascript\">"; _result += " var ad=new ad();"; if (_d.Count > 0) { foreach (var item in _d) { _result += "ad.addItem('<a href=\"http://" + item["url"] + "\" target=\"_blank\"><img src=\"./Images/upfiles/" + item["savename"] + "\" width=\"" + _width + "\" height=\"" + _height + "\" border=\"0\"></a>');"; } } else { _result += "ad.addItem('<a href=\"http://\" target=\"_blank\"><img src=\"./Images/upfiles/522d316a06132.jpg\" width=\"" + _width + "\" height=\"" + _height + "\" border=\"0\"></a>');"; } } _result += "ad.play();"; _result += "</script>"; return _result; }
/// <summary> /// 创建Banner /// </summary> /// <param name="_templet"></param> /// <param name="_d"></param> /// <returns></returns> private string CreateBannerHtml(string _templet, List<Dictionary<string, string>> _d) { var _result = string.Empty; _color = string.IsNullOrEmpty(this.circleColor) ? "#808080" : this.circleColor; _bgcolor = string.IsNullOrEmpty(this.circleBgColor) ? "orange" : this.circleBgColor; var _timespan = string.IsNullOrEmpty(this.timespan) ? "2000" : this.timespan; var _speed = string.IsNullOrEmpty(this.speed) ? "0" : this.speed; var _isCircle = this.isCircle ? "false" : "true"; var _isAuto = this.isAuto ? "false" : "true"; var _width = this.width; var _height = this.height; if (_width == 0 || _height == 0) { if (_width == 0) { _width = 500; } if (_height == 0) { _height = 200; } } if (!string.IsNullOrEmpty(_templet)) { _result = this.ReplaceTemplet(_templet, _d); } else { _isShow = true; _result += "<div class=\"banner-container\"><div class=\"banner-image\"><ul class=\"banner-image-content\">"; if (_d.Count > 0) { foreach (var item in _d) { _result += "<li><img src=\"./Images/upfiles/" + item["savename"] + "\" width=\"" + _width + "\" height=\"" + _height + "\" /></li>"; } } else { _result += "<li><img src=\"./Images/upfiles/5204630c4cf16.jpg\" width=\"" + _width + "\" height=\"" + _height + "\" /></li>"; _result += "<li><img src=\"./Images/upfiles/522d316a06132.jpg\" width=\"" + _width + "\" height=\"" + _height + "\" /></li>"; } _result += "</ul></div></div>"; } _result += "<script type=\"text/javascript\">"; _result += "$(function(){$(\".banner-container\").BannerBox({auto:true,point:" + _isCircle + ",speed:" + _speed + ",timespan:" + _timespan + "});"; _result += "});</script>"; return _result; }