功能不錯(cuò)的asp模板類代碼附下載第1/4頁
更新時(shí)間:2008年07月24日 15:06:03 作者:
在工作中,因?yàn)橐媚0孱?,在網(wǎng)上找了個(gè)asp模板類,用著挺好了。完工后也按別人的思路寫了模板類,這個(gè)模板類沒在設(shè)計(jì)的項(xiàng)目中應(yīng)用,只是練練筆,所以只寫了簡(jiǎn)單的幾個(gè)demo,有沒有bug還不清楚,歡迎大家測(cè)試,指教,幫忙完善。
此類支持循環(huán)替換,支持嵌套循環(huán)替換,支持多模板。
類的代碼就不貼不來啰嗦了,在后面有下載,只貼出demo的代碼。
一、模板只有一個(gè)循環(huán)塊
模板文件主要代碼
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{myname}模板-{webName}</title>
</head>
<body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<!-- begin a_block -->
<tr>
<td width="50" height="30">第一列</td>
<td width="50" height="30">{tpl_1}</td>
<td width="50" height="30">{tpl_2}</td>
</tr>
<!-- end a_block -->
</table>
</body>
替換模板的代碼
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="tplCls.asp"-->
<%
response.Charset="utf-8"
set newTpl=new tpl
newTpl.setTpl="tpl.html"
newTpl.setVar "myname","一個(gè)塊循環(huán)的"
newTpl.setVar "webName","亮亮的博客"
newTpl.setBlock="a_block"
for tt=0 to 2
newTpl.setBloVar "tpl_1","第二列_"&tt
newTpl.setBloVar "tpl_2","第三列_"&tt
newTpl.outBloVar
next
newTpl.outBlock "a_block"
newTpl.out
set newTpl=nothing
%>
類的代碼就不貼不來啰嗦了,在后面有下載,只貼出demo的代碼。
一、模板只有一個(gè)循環(huán)塊
模板文件主要代碼
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{myname}模板-{webName}</title>
</head>
<body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<!-- begin a_block -->
<tr>
<td width="50" height="30">第一列</td>
<td width="50" height="30">{tpl_1}</td>
<td width="50" height="30">{tpl_2}</td>
</tr>
<!-- end a_block -->
</table>
</body>
替換模板的代碼
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="tplCls.asp"-->
<%
response.Charset="utf-8"
set newTpl=new tpl
newTpl.setTpl="tpl.html"
newTpl.setVar "myname","一個(gè)塊循環(huán)的"
newTpl.setVar "webName","亮亮的博客"
newTpl.setBlock="a_block"
for tt=0 to 2
newTpl.setBloVar "tpl_1","第二列_"&tt
newTpl.setBloVar "tpl_2","第三列_"&tt
newTpl.outBloVar
next
newTpl.outBlock "a_block"
newTpl.out
set newTpl=nothing
%>
相關(guān)文章
ASP 常見對(duì)象總結(jié)(熟悉一下利用以后的開發(fā)使用)
ASP 常見對(duì)象總結(jié)(熟悉一下利用以后的開發(fā)使用)2009-11-11asp #include file 與 #include virtual 的區(qū)別小結(jié)
簡(jiǎn)單來說,#include file后面跟的是文件的“相對(duì)路徑”, #include virtual后面跟的是文件的“絕對(duì)路徑”。2009-06-06用ASP實(shí)現(xiàn)遠(yuǎn)程將文件批量改名的代碼
用ASP實(shí)現(xiàn)遠(yuǎn)程將文件批量改名的代碼...2007-09-09asp cookie中文Javascript取得中文cookie
這篇文章主要介紹了asp cookie中文Javascript取得中文cookie,原理就是將中文編碼改成UTF-8編碼格式,傳到前臺(tái),再用JS將其解碼2014-07-07asp下對(duì)POST提交數(shù)據(jù)限制的解決方法
由于微軟對(duì)POST提交數(shù)據(jù)的大小進(jìn)行了限制,當(dāng)表單發(fā)送的數(shù)據(jù)量很大時(shí),就會(huì)報(bào)錯(cuò)(錯(cuò)誤 "ASP 0107 : 80004005")。原因是微軟對(duì)用Request.Form()可接收的最大數(shù)據(jù)限制為100K字節(jié)。2008-06-06asp導(dǎo)出excel文件最簡(jiǎn)單方便的方法
這篇文章主要介紹了asp導(dǎo)出excel文件最簡(jiǎn)單方便的方法,幾行代碼就可以搞定,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下2014-08-08