new template("."); $t->set_file("fhandle","main.htm"); $t->set_block("fhandle","row","{rows}"); for($i=0;$i set_var("filed1","随便啦。。。"); $t->set_var("filed2","随便啦。。。"); $t->parse("row","row",true); } $t->pparse("out","fhandle"); ?>" name=description>

InfoQ

交流

讨论:模板blocK问题

作者 游子云 发布于 2003-08-01 分类:php基础编程

<-- main.htm-->
filed1 filed2
{filed1}{filed2}
<--test.php--> <? include("/lib/template.inc"); $t->new template("."); $t->set_file("fhandle","main.htm"); $t->set_block("fhandle","row","{rows}"); for($i=0;$i<10;i++) { $t->set_var("filed1","随便啦。。。"); $t->set_var("filed2","随便啦。。。"); $t->parse("row","row",true); } $t->pparse("out","fhandle"); ?>



逛论坛交流模板blocK问题

加入书签
digg+,
reddit+,
del.icio.us+,
dzone+

1 条回复

回复

[php] <? include("template.i.. 发表人 冬冬 发表于 08月16日
  1. 返回顶部

    Re: 模板blocK问题

    2003年08月16日 发表人 冬冬

    [php]
    <?
    include("template.inc");
    $t = new Template(".");
    $t->set_file("fhandle","main.htm");
    $t->set_block("fhandle","row","rows");
    for($i=0; $i<10; $i++) {
    $t->set_var(array(
    "filed1" => "冬冬A{$i}",
    "filed2" => "冬冬B{$i}"
    )
    );
    $t->parse("rows","row",true);
    }
    $t->pparse("out","fhandle");
    ?>
    [/php]




  2. 我有话要讲:(可以匿名发表, 发广告的有多远请滚多远!!!)

    昵称: 请输入验证码:


抢着回答

Slants

so经典!老外的脑袋确实想象力丰富 http://www.infimum.dk...

关于pg_set_client_encoding的问题!!...

为什么在linux下这个函数是对的,可是服务器移到windows下,却不...

奇怪的问题!

Warning: mysql_pconnect() [function.mysql-pconnect]: Link to...

PHP空间问题

怎么让你的PHP空间支持smarty?就是说怎么设置里面的php.ini?? ...

关于在线人数统计的问题。。

很多人都采用建一个online的数据库,我想可不可以在用户的基本注...

请教“可变变量”的问题!

下面这段代码是我的PHP书中,讲到“可变的变量”这部分。 [PHP]...

PHP Version 5.0.0b2 测试程序及代码

编译的时候老是出现libxml2的一个错误(不知是什么原因,不管我加...

郁闷,装不上?

[root@server httpd-2.0.48]# ./configure --prefix=/usr/local/...

我的留言薄已更新。请大家参观

网址: http://jaryer.computersci.net/guestbook/index.php ...

GD库怎样支持中文?

GD库怎样支持中文?各位帮忙指点以下。

[]