在做asp.net静态生成的时候用什么静态生成的方法比较好?
比较方便的是用webclient类的downloadfile来做,不过好象用这个方法的人不是很多,不知道为什么.效率问题吗?
还有一个常用的方法是做一个模板然后字符串替换.
这两种方法哪一个比较好?
还有在用模板的时候可不可以做的和zblog那样的自定义,比如说在模板里面写这样的:
#文章列表(类别1,显示的数量,显示的内容)#
#articleList(10,10,'title,author,pubtime')#用这样的模板根据模板里面的参数做生成相应的静态页面应该如何做呢?
比较方便的是用webclient类的downloadfile来做,不过好象用这个方法的人不是很多,不知道为什么.效率问题吗?
还有一个常用的方法是做一个模板然后字符串替换.
这两种方法哪一个比较好?
还有在用模板的时候可不可以做的和zblog那样的自定义,比如说在模板里面写这样的:
#文章列表(类别1,显示的数量,显示的内容)#
#articleList(10,10,'title,author,pubtime')#用这样的模板根据模板里面的参数做生成相应的静态页面应该如何做呢?
用它下载本地文件的内容
再用streamwriter生成html文件...我的静态就是这么生成的。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>相关链接东营市中级人民法院“东营经验”专题</title>
<link href="index.css" rel="stylesheet" type="text/css">
<base target="_blank">
</head><body>
<table width="770" height="241" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="250" height="128" valign="top"><table width="240" height="30" border="0" cellpadding="0" cellspacing="0" style="border:#A1A1A1 1px solid">
<tr>
<td width="238" height="30" background="images/bg2.jpg"> </td>
</tr>
</table></td>
<td width="520" valign="top"><table width="520" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="29" background="images/news4.jpg"><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="433" class="lanmu">相关链接</td>
<td width="67" class="img-title"><strong><a href="default.htm"><font color="#CC0000">返回首页</font></a></strong></td>
</tr>
</table></td>
</tr> </table>
<table width="520" height="598" border="0" cellpadding="0" cellspacing="0" style="border:#990000 1px solid">
<tr>
<td height="595" valign="top"><table width="500" height="14" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="14"> </td>
</tr>
</table><br>
<table width="500" height="14" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="TextList4" valign="top"><%=GetPageNews("xglj",null,537,1,Request["PageNum"],18)%></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
</table>
</body>
</html>
cms系统都是做一个模板然后字符串替换的.
网页设计大本营
我的首页和新闻页就是生成静态页.先dw做好模板,需要的位置,加上特殊符号.
后台写好一个方法,从数据库里读数据,替换....
需要的话联系我,给你源码参考下
#文章列表(类别1,显示的数量,显示的内容)#
#articleList(10,10,'title,author,pubtime')# 这种方式还是替换,替换时可用正则表达式匹配 标记名(articleList)、参数((10,10,'title,author,pubtime')# ),根据标记名调用相应的函数获取内容,再替换。这种方法仅仅简化了用户的使用,但并不是最灵活的方式!