现在大部分模板类中都提供block功能,block用来处理不确定个数的html 元素,当出现多层不可定的元素,就会用到block的嵌套,对于block嵌套的用法,经过多次测试还是有需要注意的地方,下面用一个例子说明block嵌套的一种处理方法。
1、我们先来看一下例子要达到的效果(图一):
2、模板文件test.htm
模板文件就是静态的页,可以用你喜欢的网页编辑器编制他的外观
<!doctype html public "-//w3c//dtd html 4.01 transitional//en">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<table width="400" border="1" bordercolor="#000000">
<tr><td><div align="center">{myname}测试block</div></td></tr>
<tr><td>我的动植园:</td> </tr>
<!-- begin animallist -->
<tr><td>{animal}</td></tr>
<!-- begin plantlist -->
<tr><td> {plant}</td></tr>
<!-- end plantlist -->
<!-- end animallist -->
</table>
</body>
</html>
3、下面是php代码文件test.php
<?php
include_once("templa
| 对此文章发表了评论 |
