菜鸟请教phplib中的block问题
yyst 2003-12-04 11:31:43 模板 tstemp.ihtml [code]
<html>
<body>
<table width="300" border="0">
<tr>
<td>welcome!</td>
</tr>
<!-- begin tsc -->
<tr>
<td>this is the {colors} sky!</td>
</tr>
<!-- end tsc -->
</table>
</body>
</html>
PHP页 [code]
<?PHP
include_once("phplib72/php/template.inc");
$ts = new Template("template/");
$col = "blue";
$ts->set_file("tshandle","tstemp.ihtml");
$ts->set_block("tshandle","tsc","tscs");
for ($i=1; $i<5; $i++)
{
$ts->set_var("colors",$col);
$ts->parse("tscs","tshandle",true); -----(**)
}
$ts->parse("tsoutput","tshandle");
$ts->p("tsoutput");
?>
分块输出无效,只能输出一行。请问是哪里的错误?
并且从网上和书中看的例子里面,加(**)这一行应该是
$ts->parse("tscs","tsc",true); (中间的参数是块的名称,而不是handle)
这样用的话会报错,说 tsc 不是一个 handle,难道网上和书中的例子都错了?
请各位高手多多指点!