page.ihtml文件内容
<html>
<head><title>{PAGETITLE}</title></head>
<body bgcolor="#ffffff">
<table border=1 cellpadding=4 cellspacing=0 bgcolor="#eeeeee">
<tr>
<td colspan=2><h1>{PAGETITLE}</h1></td>
</tr>
<tr>
<td>{OUT}</td>
<td>Content</td>
</tr>
</table>
</body>
</html>box.ihtml文件内容
<!-- start box.ihtml -->
<table border=1 bgcolor="#cccccc" cellpadding=4 cellspacing=0>
<tr>
<td colspan=2><b>{TITLE}</b></td>
</tr>
<!-- BEGIN row -->
<tr>
<td>{NUM}</td>
<td>{BIGNUM}
</tr>
<!-- END row -->
</table>
<!-- end box.ihtml -->
模板使用例子
<?php
include("./template.inc"); # create Template instance called $t
$t = new Template("/page/to/webserver/template", "keep"); # define variables named page and box, referencing files
$t->set_file(array(
"page" => "page.ihtml",
"box" => "box.ihtml")); # extract the block named "row" from "box", creating a
# reference to {rows} in "box".
$t->set_block("box", "row", "rows"); # define the variables TITLE and PAGETITLE
$t->set_var(array("TITLE" => "Testpage",
"PAGETITLE" => "hugo")); # define NUM and BIGNUM, then append "row" to "rows"...
for ($i=1; $i<=3; $i++) {
$n = $i;
$nn = $i*10;
$t->set_var(array("NUM" => $n, "BIGNUM" => $nn));
$t->parse("rows", "row", true);
} # build out from box, then build out from page...
$t->parse("out", array("box", "page")); # finish out and print it.
$t->p("out");
?>
<hr>
<?php
# report leftover variables, if any.
print implode(", ", $t->get_undefined("rows"));
?>要是不明白自己看Phplib的文档
<html>
<head><title>{PAGETITLE}</title></head>
<body bgcolor="#ffffff">
<table border=1 cellpadding=4 cellspacing=0 bgcolor="#eeeeee">
<tr>
<td colspan=2><h1>{PAGETITLE}</h1></td>
</tr>
<tr>
<td>{OUT}</td>
<td>Content</td>
</tr>
</table>
</body>
</html>box.ihtml文件内容
<!-- start box.ihtml -->
<table border=1 bgcolor="#cccccc" cellpadding=4 cellspacing=0>
<tr>
<td colspan=2><b>{TITLE}</b></td>
</tr>
<!-- BEGIN row -->
<tr>
<td>{NUM}</td>
<td>{BIGNUM}
</tr>
<!-- END row -->
</table>
<!-- end box.ihtml -->
模板使用例子
<?php
include("./template.inc"); # create Template instance called $t
$t = new Template("/page/to/webserver/template", "keep"); # define variables named page and box, referencing files
$t->set_file(array(
"page" => "page.ihtml",
"box" => "box.ihtml")); # extract the block named "row" from "box", creating a
# reference to {rows} in "box".
$t->set_block("box", "row", "rows"); # define the variables TITLE and PAGETITLE
$t->set_var(array("TITLE" => "Testpage",
"PAGETITLE" => "hugo")); # define NUM and BIGNUM, then append "row" to "rows"...
for ($i=1; $i<=3; $i++) {
$n = $i;
$nn = $i*10;
$t->set_var(array("NUM" => $n, "BIGNUM" => $nn));
$t->parse("rows", "row", true);
} # build out from box, then build out from page...
$t->parse("out", array("box", "page")); # finish out and print it.
$t->p("out");
?>
<hr>
<?php
# report leftover variables, if any.
print implode(", ", $t->get_undefined("rows"));
?>要是不明白自己看Phplib的文档
解决方案 »
- 如何将不同文件夹下的需求的图片复制到新文件夹去?
- 服务器每隔断时间发送信息的原理是什么?
- Parse error: parse error, unexpected $end
- 关于PHP模板标签的转换
- [江湖急救]我使用history.go(-1)回到前一页,为什么信息会消失不见?
- 菜鸟问个编码问题常用的utf-8是哪种啊?utf_bin,utf_czech_ci????
- 分页提交的问题
- 小弟刚入门php,请教数据提交问题!!
- 如何合并两个数据库,并删除其中的重复部分。
- 请问关于php变量的问题
- 我载网上升级了linux,包括apache,php,mysql,现在php不能解析,只能是静态的,急!
- 2003-06-07 18:50:44+30 min. 怎么计算
但PHPLIB >>> PHPLIB.template
--------------------------------------------------------
function Template($root = ".", $unknowns = "remove")
function set_root($root)
function set_unknowns($unknowns = "remove")
function set_file($varname, $filename = "")
function set_block($parent, $varname, $name = "")
function set_var($varname, $value = "")
function subst($varname)
function psubst($varname)
function parse($target, $varname, $append = false)
function pparse($target, $varname, $append = false)
function get_vars()
function get_var($varname)
function get_undefined($varname)
function finish($str)
function p($varname)
function get($varname)
function halt($msg)
function haltmsg($msg)
--------------------------------------------------
怎么把名改了。记得好象不叫唯她吧。是不是找到自己的另一半了?
以前的名用的太久,该脱下来洗洗了.另一半?:几年前就有了!
--------------------------------
楼主可到phpe.net看看!有关内容不少!