功能不錯的asp模板類代碼附下載第2/4頁
更新時間:2008年07月24日 15:06:03 作者:
在工作中,因為要用模板類,在網(wǎng)上找了個asp模板類,用著挺好了。完工后也按別人的思路寫了模板類,這個模板類沒在設(shè)計的項目中應(yīng)用,只是練練筆,所以只寫了簡單的幾個demo,有沒有bug還不清楚,歡迎大家測試,指教,幫忙完善。
二、兩個塊循環(huán),并且在一個模板中加載另一個模板
主模板文件主要代碼
<title>{myname}模板-{webName}</title>
</head>
<body>
<table cellspacing="2" border="1">
<tr><td>下面的動物您喜歡哪一種</td></tr>
<!-- begin list1 -->
<tr><td><input type="radio" name="chk">{animal}</td></tr>
<tr bgcolor="#3366FF"><td height="10"></td>
</tr>
<!-- end list1 -->
<!-- begin list2 -->
<tr><td><input type="radio" name="chk">{animal2}</td></tr>
<tr bgcolor="#3366FF"><td height="10"></td>
</tr>
<!-- end list2 -->
<tr><td colspan="2">{PageNo}</td></tr>
</table>
</body>
副模板文件主要代碼
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30">這是嵌套進來的模板</td>
</tr>
<tr>
<td height="30"><!-- begin inList -->{inStr} <!-- end inList --></td>
</tr>
</table>
替換模板的代碼
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="tplCls.asp"-->
<%
response.Charset="utf-8"
set newTpl=new tpl
newTpl.setTpl="tpl2.html"
newTpl.setVar "myname","兩個塊循環(huán)/嵌套的"
newTpl.setVar "webName","亮亮的博客"
newTpl.setBlock="list1"
for i=0 to 2
newTpl.setBloVar "animal","animal"&i
newTpl.outBloVar
next
newTpl.outBlock "list1"
newTpl.setBlock="list2"
for m=0 to 2
newTpl.setBloVar "animal2","動物"&m
newTpl.outBloVar
next
newTpl.outBlock "list2"
'加載副模板
newTpl.setVarTpl "PageNo","inTpl.html"
'替換副模板中的內(nèi)容
newTpl.setBlock="inList"
for k=0 to 3
newTpl.setBloVar "inStr","menu"&k
newTpl.outBloVar
next
newTpl.outBlock "inList"
newTpl.out
set newTpl=nothing
%>
相關(guān)文章
ASP移動文件函數(shù)movefile權(quán)限不足的替代方法
這篇文章主要介紹了ASP移動文件函數(shù)movefile權(quán)限不足的替代方法,本文先是介紹了一個替代方法,后又找出了實際原因,需要的朋友可以參考下2014-07-07

