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的文档
解决方案 »
- 晒一下我的模板引擎,欢迎拍砖
- 求助关于TinyEditor编辑器传值的问题。
- 求PHP 发送HTTP 请求返回XML的代码
- 请教一个类的实例化问题
- 有人要域名吗?本人转让。
- 求助:phpMyAdmin不能启动?
- 關於php開發的軟件
- !!!!!!如何将这样的文本通过php导入到mysql啊!!!!!!
- 如何实现用户在登陆好以后一定时间内若没有活动,其session自动过期?
- 为什么我在处理上一页提交的时候,不能直接用名称来取到值?
- 我载网上升级了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看看!有关内容不少!