<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="{dede:global.cfg_templets_skin/}/images/apple-touch-icon-57.png" sizes="57x57" rel="apple-touch-icon">
<link href="{dede:global.cfg_templets_skin/}/images/apple-touch-icon-72.png" sizes="72x72" rel="apple-touch-icon">
<link href="{dede:global.cfg_templets_skin/}/images/apple-touch-icon-114.png" sizes="114x114" rel="apple-touch-icon">
<title>{dede:global.cfg_webname/}</title>
<meta name="keywords" content="{dede:global.cfg_keywords/}">
<meta name="description" content="{dede:global.cfg_description/}">
<link href="{dede:global.cfg_templets_skin/}/style/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="{dede:global.cfg_templets_skin/}/style/jquery-1.9.1.js"></script>
<script type="text/javascript" src="{dede:global.cfg_templets_skin/}/style/theme_trust.js"></script>
<style type="text/css">
html,
body {
margin: 0
padding: 0
}
.iw_poi_title {
color: #CC5522
font-size: 14px
font-weight: bold
overflow: hidden
padding-right: 13px
white-space: nowrap
}
.iw_poi_content {
font: 12px arial, sans-serif
overflow: visible
padding-top: 4px
white-space: -moz-pre-wrap
word-wrap: break-word
}
</style>
<script type="text/javascript" src="{dede:global.cfg_templets_skin/}/main.js"></script>
<script>
jQuery(document).ready(function() {
jQuery('#openSidebar').click(function() {
jQuery('.wrapper').toggleClass('openNav')
})
jQuery('#menu a').click(function() {
jQuery('.wrapper').removeClass('openNav')
})
})
</script>
<script type="text/javascript" src="{dede:global.cfg_templets_skin/}/api"></script><script type="text/javascript" src="{dede:global.cfg_templets_skin/}/getscript"></script><link rel="stylesheet" type="text/css" href="{dede:global.cfg_templets_skin/}/bmap.css">
<style type="text/css">
html,
body,
wrapper {
height: 100%
}
</style>
</head>
<body>
<div class="wrapper">
<div class="sidebar">
<div class="clearfix k1120">
<div class="navBox" id="openSidebar">
<a href="javascript:void(0)" class="navOpen"></a>
</div>
<div id="menu">
<ul class="clearfix">
<li><a href="#home" class="nav_home current"><span>首页<br /><b>Home</b></span></a>
</li>
<li><a href="#services" class="nav_services"><span>服务范围<br /><b>Services</b></span></a>
</li>
<li><a href="#case" class="nav_case"><span>案例展示<br /><b>Case</b></span></a>
</li>
<li><a href="#about" class="nav_about"><span>关于我们<br /><b>About us</b></span></a>
</li>
<li><a href="#news" class="nav_news"><span>新闻动态<br /><b>News</b></span></a>
</li>
<li><a href="#contact" class="nav_contact"><span>联系我们<br /><b>Contact us</b></span></a>
</li>
</ul>
</div>
</div>
</div>
<div class="pageMain">
<div id="header">
<div class="k1120 clearfix"><a href="{dede:global.cfg_basehost/}" id="logo">logo</a>
</div>
</div>
<div id="home" class="scrol-page">
<div class="banner">
<div class="b_1" style="background-position: 50% 0px">
<div class="k1120 clearfix">
<div class="b_pic">
<div class="mac" style="margin-top: 0pxopacity: 1"><img src="{dede:global.cfg_templets_skin/}/images/mac.png">
</div>
<div class="iphone" style="margin-top: 0pxopacity: 1"><img src="{dede:global.cfg_templets_skin/}/images/iphone.png">
</div>
<div class="ipad" style="margin-top: 0pxopacity: 1"><img src="{dede:global.cfg_templets_skin/}/images/ipad.png">
</div>
</div>
<div class="b_text" style="margin-top: 0pxopacity: 1">
{dede:global.cfg_ggg/}
</div>
</div>
</div>
</div>
<div class="banner">
1、ASP文件中的代码pencat=rs.Fields.Item("m_content").Value
pencat=replace(pencat,"t_title",n_title)
pencat=replace(pencat,"t_author",n_author)
pencat=replace(pencat,"t_content",n_content)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(fpath&"\" &fname))
fout.WriteLine pencat
fout.close
2、如下给出要生成的网页模板:
<html>
<head>
<meta http-equiv=""Content-Language"" content=""zh-cn"">
<meta http-equiv=""Content-Type"" content=""text/htmlcharset=gb2312"">
<meta name=""GENERATOR"" content=""Microsoft FrontPage 4.0"">
<meta name=""ProgId"" content=""FrontPage.Editor.Document"">
<title></title>
</head>
<body topmargin=""0"" leftmargin=""0"">
<table border=""0"" width=""760"" height=""100%"" background=""background.jpg"" >
<tr>
<td width=""752"" height=""10"" colspan=""3"">
<p align=""center"">t_title
</td>
</tr>
<tr>
<td width=""752"" height=""18"" colspan=""3"">
<div align=""center"">
</div>
<div align=""center"">
<font size=""2"">
作者:</font><font color=""#990000"">t_author</font>
<font size=""2"">
加入时间:</font><font color=""#990000"">t_date</font>
</div>
</td>
</tr>
<tr>
<td width=""15%"" height=""100%"" valign=""top"">
</td>
<td width=""70%"" height=""100%"" valign=""top"">
t_content
</td>
<td width=""15%"" height=""100%"" valign=""top"">
</td>
</tr>
</table>
</body>
</html>
3、解释
(1)pencat=rs.Fields.Item("m_content").Value
pencat为一个字符串变量。
rs.Fields.Item("m_content").Value就是如上2、网页模板的全部HTML字符
(2)pencat=replace(pencat,"t_title",n_title)
pencat=replace(pencat,"t_author",n_author)
pencat=replace(pencat,"t_content",n_content)
以上三句就是将字符串中的字串替换成为你所需要的内容,即ASP中动态获得的内容。
(3)Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(fpath&"\" &fname))
fout.WriteLine pencat
fout.close
以上为将刚刚组合所得的网页代码写入文件的过程。第一句定义fso文件,第二句创建输出流文件,其中fpath为你想要存储的文件的路径,fname为文件名;后两句是将字符串写入文件和关闭输出流文件。
<!--这个模版来自[最好模版-http://BestMoban.Com],需要更多模版请访问http://BestMoban.Com--><html>
<head>
<meta http-equiv="Content-Type" content="text/html charset=gb2312">
<title>┆假想敌┆- 颓废模板</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth document.MM_pgH=innerHeight onresize=MM_reloadPage }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload()
}
MM_reloadPage(true)
//-->
</script>
<style type="text/css">
<!--
BODY {
SCROLLBAR-FACE-COLOR: #3F2413
SCROLLBAR-HIGHLIGHT-COLOR:
#FFFFFF
SCROLLBAR-SHADOW-COLOR: #ffffff
SCROLLBAR-3DLIGHT-COLOR: #3F2413
SCROLLBAR-ARROW-COLOR:
#FFFFFF
SCROLLBAR-TRACK-COLOR: #3F2413
SCROLLBAR-DARKSHADOW-COLOR: #3F2413
background-color: #FFFFFF
background-image: url(bg.jpg)
}
-->
</style>
</head>
<body>
<div id="Layer1" style="position:absolute width:1000px height:628px z-index:1 left: 0px top: 0px">
<div align="center">
<p>&nbsp</p>
<p>&nbsp</p>
<p>&nbsp</p>
<p>&nbsp</p>
<p><img src="1.jpg" width="650" height="400" border="0" usemap="#Map2">
<map name="Map2">
<area shape="rect" coords="321,379,490,399" href="http://www.jxd88.com/" target="_blank" alt="┆假想敌┆">
<area shape="rect" coords="196,15,242,43" href="home.htm" target="main1" alt="home">
</map>
<map name="Map">
<area shape="rect" coords="18,196,60,220" href="home.htm" target="main1" alt="home">
</map>
</p>
</div>
</div>
<div id="Layer2" style="position:absolute width:412px height:295px z-index:2 left: 382px top: 203px">
<iframe src="home.htm" name="main1" width="412" height="295"
frameborder="0" scrolling="yes" style="border:0px"allowtransparency="true"></iframe></div>
</body>
</html>
<span style="display:none">这个模版来自http://BestMoban.Com,更多模版请访问<a href="http://BestMoban.Com">http://BestMoban.Com</a>&nbsp<a href="http://Moban.17Easy.Com">http://Moban.17Easy.Com</a>&nbsp<a href="http://www.mb8.cn">http://www.mb8.cn</a></span>