冰冻宇猪猪

冰冻宇猪猪的BLOG 哈哈哈~~~
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
昨天在CSDN论坛上看了一下,有个人发了个例子,简约轻便,比较适合初学者,发上来记号一下:

此功能比较简单,更多功能可自已开发,当然,高手就不用看了,见笑了。把下面这两个文件放到同一个目录下即可:

h_index.htm文件:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<center>
<table width="694" border="0" cellpadding="0" cellspacing="0">
  
<!--DWLayoutTable-->
  
<tr>
    
<td width="694" height="57" align="center" valign="middle"><font color="#FF0000">{newstitle}</font><br/><br/>{addtime}<br/><hr><br/></td>
  
</tr>
  
<tr>
    
<td height="33" align="left" valign="top">{content}</td>
  
</tr>
</table>
</center>
</body>
</html>



index.asp文件:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
 
set fso=CreateObject("Scripting.FileSystemObject")
 
set f=fso.OpenTextFile(server.mappath("h_index.htm"))
 content
=f.ReadAll
 f.close
 
set f=nothing
 
set fso=nothing
 
content
=replace(content,"{newstitle}","一个模板与代码分离的方法")
content
=replace(content,"{addtime}","时间:2005-07-30")
content
=replace(content,"{content}","新闻内容,试测中。。")
response.write content
response.end()
%
>