一、新建数据表dt_ipa
二、DAL数据访问层:DTcms.DALarticle.cs
/// /// 获取ip /// /// /// public bool GetIp(string ipa) //判断是否存在ip { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from " + databaseprefix + "ipa"); strSql.Append(" where ipa=@ipa "); SqlParameter[] parameters = {new SqlParameter("@ipa", SqlDbType.NVarChar,50)}; parameters[0].Value = ipa; return DbHelperSQL.Exists(strSql.ToString(), parameters); }
三、BLL业务逻辑层:DTcms.BLLarticle.cs
/// /// 是否存在于IP列表 /// /// public bool Getip(string ipa) { return dal.GetIp(ipa); }
四、Web.UI标签:DTcms.Web.UILabelarticle.cs
/// /// 是否存在于IP列表 /// /// protected bool getip() { string guestip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); return new BLL.article().Getip(guestip); }
五、发布网站后,将Bin文件夹里的文件覆盖,新建频道,修改模板:*_show.html
1、新建频道:控制面板---站点管理---频道管理---新增(以kaohetongbao为例)
2、频道URL配置:
列表页kaohetongbao_all表达式:
(1)kaohetongbao_all.aspx
(2)kaohetongbao-{0}-{1}.aspx,类别ID=数字,分页页码=字符串,设置分页大小条数
列表页kaohetongbao_list表达式:
(1)kaohetongbao/{0}.aspx,类别ID=数字
(2)kaohetongbao/{0}/{1}.aspx,类别ID=数字,分页页码=字符串,设置分页大小条数
详细页kaohetongbao_show表达式:
(1)kaohetongbao/show-{0}.aspx,文章ID=数字
3、修改模板:kaohetongbao_show.html
{model.content}
您没有访问权限!