您的位置:首页 > 编程语言 > ASP

asp.net2.0自动根据用户自定义字数生成带分页的静态(HTML)页

2008-04-29 09:59 726 查看
闲来无事,其他的人都在忙着迎新生,正好要用到生成静态页的东西,于是开始搜索,但是一直没有找到我自己想要的合适的东西,比如我要有自己的文件夹,可以根据自己的需要放进去,我要生成按年/月/日分开的静态页完整的RL举个例子来说就是:
http://www.***.com/news/sport/20070908/1_1.html

其中呢像news/sport/20070908 都是动态生成的!并且要求生成出来的静态页要能够自己分页!

有了这个需求,下面大概介绍一下我的思路,首先就是你的服务器要有fso权限,那么你就可以生成文件夹了!生成的文件夹呢就是你存放html文件的path,那么我们还需要定义html文件的名称如1_1.html,其中第一个1是新闻的id,第二个1呢就是页码,生成静态页的思想呢用到的就是标签替换的思想!当然我这里没有实现按照时间段批量生成,不过考虑到这才是第一个版本,以后还会陆续添加,来看看图片吧!

private void creatHTML()
private string checkFile()
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>$title</title>
<link rel="stylesheet" rev="stylesheet" href="../CSS/Main.css" type="text/css" />
</head>
<body>
<div style="margin:0px auto; text-align:center; padding:2px;width:80%; border:1px solid #d7d7d7;">
<div style=" text-align:center; float:left; width:100%; margin:0px 0px 10px 0px;">
<span class="fs13 isbold cblack">$title</span>
<br />
<hr style="text-align:center; size:1px;" />
</div>
<div style=" text-align:left; float:left; width:100%; margin:0px 0px 10px 0px;">
<span class="fs12" style="line-height:20px;">$content</span>
</div>
<div style=" margin:0px auto; text-align:center; width:98%; border:1px solid #d7d7d7; background-color:#ececec; height:20px;">
<span class="fs12">$page</span>
</div>
</div>
</body>
</html>
想要的留个邮箱吧!

希望高手帮我指正!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: