`
nmv884rp
  • 浏览: 24820 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

asp编程中网站系统设置文件webconfig.asp文件的写法-ASP编程

阅读更多

asp编程中网站系统设置文件webconfig.asp文件的写法-ASP编程
2010年04月04日
          我们在编写asp小型程序的时候,网站配置这一项在前台的所有页面都可能用到,比如设置网站的开关、注册开关、列表页显示条数等,有许多程序员都是把这些频繁调用的东东写入数据库,然后前台读取数据库存入变量中,然后调用,其实这样做很是耗资源,直接保存成一个asp文件不是更好么?下面我们就简单的说一下实现的方法;
  1.假如我们的网站配置文件就叫webconfig.asp,内容如下:
  

  以下为引用的内容:
  
  2.在我们的后台管理中就可以这样操作这个文件:
  

  以下为引用的内容:
  
  
  
  Const ForReading =1, ForWriting = 2
  if action="ok" then
  website = trim(Request.form("website"))
  weburl = trim(Request.form("weburl"))
  mail = trim(Request.form("mail"))
  newsperpage = trim(Request.form("newsperpage"))
  artlinenum = trim(Request.form("artlinenum"))
  artzinum = trim(Request.form("artzinum"))
  h_artlinenum = trim(Request.form("h_artlinenum"))
  h_artzinum = trim(Request.form("h_artzinum")) 
  voteincdir = server.mappath("config.asp")
  set fs = CreateObject("Scripting.FileSystemObject")
  set ts = fs.OpenTextFile(voteincdir,ForWriting, True)
  ts.Write ""
  ts.Write ""
  ts.close
  response.write ""
  response.write "alert('系统设置成功!');"
  response.write ""
  end if
  %>
  
  
  
  
  修改信息列表
  
  
  
  
  
  
  
  
  系统设置
  
  
  本站站名:
  " size="30">
  
         
  
  
  本站网址:
  " size="30">
  例(http://www.strongfire.cn)     
  
  
  站长信箱:
  " size="30">
  例(strongfire2008@163.com)     
  
  
  分类信息生成显示条数:
  " size="5" maxlength="2">
  
  
  
  分类信息标题显示的字数:
  " size="5" maxlength="2">
  超出时会以...结束
  
  
  推荐信息、热门信息、最新信息显示条数
  " size="5" maxlength="2">
  
  
  
  推荐信息、热门信息、最新信息标题显示的字数:
  " size="5" maxlength="2">
  超出时会以...结束
  
  
  每页所显示的条数:
  " size="5" maxlength="2">
  
  
  
  
     
  
  
  
  
  
  3.在前台我们这样调用文件中的变量:
  
  是不是很简单啊,省的每次都操作数据库,是不是网站的速度又快了一些啊;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics