3. There are nested loops in the block
Main code of template file
<title>{myname} template-{webName}</title>
</head>
<body>
<table width="400" border="1" bordercolor="#000000">
<tr><td><div align="center">{myname}test</div></td></tr>
<tr><td>Animals:</td> </tr>
<!-- begin list -->
<tr><td>{animal}</td></tr>
<!-- begin list_1 -->
<tr><td> {plant}_{num}</td></tr>
<!-- begin list_1_1 -->
<tr><td> {plant2}</td></tr>
<!-- end list_1_1 -->
<!-- end list_1 -->
<!-- end list -->
</table>
</body>
Replace the template file code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file=""-->
<%
="utf-8"
set newTpl=new tpl
=""
"myname", "Nested loop"
"webName", "Light-Light Blog"
="list"
for i=0 to 2
"animal", "animal category"&i
="list_1"
for m=0 to 2
"plant", "animals"
"num",m
="list_1_1"
for k=0 to 1
"plant2", "animal"&k
next
"list_1","list_1_1"
="list_1"
next
"list","list_1"
'Note the use of resetBlock
="list"
next
"list"
set newTpl=nothing
%>
Pay attention to the use of resetBlock. When there is still loop in the block, use this method before next.
Previous page1234Next pageRead the full text