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的文档

解决方案 »

  1.   

    /page/to/webserver/template是你保存模板文件的目录!
      

  2.   

    如果只是用PHPLIB的模板,搞懂下面几个函数就可以了.
    但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) 
    --------------------------------------------------
      

  3.   

    netvt(唯她 v1.1.1)
    怎么把名改了。记得好象不叫唯她吧。是不是找到自己的另一半了?
      

  4.   

    to:allkill.
    以前的名用的太久,该脱下来洗洗了.另一半?:几年前就有了!
    --------------------------------
    楼主可到phpe.net看看!有关内容不少!
      

  5.   

    楼主可到phpe.net看看!有关内容不少!