日期:2011-06-21  浏览次数:20540 次

<?php
//
// Copyright ?2000-2001, Roland Roberts <roland@astrofoto.org>
//             2001 Alister Bulman <alister@minotaur.nu> Re-Port multi template-roots + more
// PHP3 Port: Copyright ?1999 CDI <cdi@thewebmasters.net>, All Rights Reserved.
// Perl Version: Copyright ?1998 Jason Moore <jmoore@sober.com>, All Rights Reserved.
//
// RCS Revision
//   @(#) $Id: class.rFastTemplate.php,v 1.22 2001/10/18 21:36:53 roland Exp $
//   $Source: /home/cvs/projects/php/tools/class.rFastTemplate.php,v $
//
// Copyright Notice
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2, or (at your option)
//    any later version.
//
//    class.rFastTemplate.php is distributed in the hope that it will be
//    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    General Public License for more details.
//
// Comments
//
//    I would like to thank CDI <cdi@thewebmasters.net> for pointing out the
//    copyright notice attached to his PHP3 port which I had blindly missed
//    in my first release of this code.
//
//    This work is derived from class.FastTemplate.php3 version 1.1.0 as
//    available from http://www.thewebmasters.net/.  That work makes
//    reference to the "GNU General Artistic License".  In correspondence
//    with the author, the intent was to use the GNU General Public License;
//    this work does the same.
//
// Authors
//
//    Roland Roberts <roland@astrofoto.org>
//    Alister Bulman <alister@minotaur.nu> (multi template-roots)
//    Michal Rybarik <michal@rybarik.sk> (define_raw())
//    CDI <cdi@thewebmasters.net>, PHP3 port
//    Jason Moore <jmoore@sober.com>, original Perl version
//
// Synopsis
//
//    require ("PATH-TO-TEMPLATE-CODE/class.Template.php");
//    $t = new Template("PATH-TO-TEMPLATE-DIRECTORY");
//    $t->define (array(MAIN => "diary.html"));
//    $t->setkey (VAR1, "some text");
//    $t->subst (INNER, "inner")
//    $t->setkey (VAR1, "some more text");
//    $t->subst (INNER, ".inner")
//    $t->setkey (VAR2, "var2 text");
//    $t->subst (CONTENT, "main");
//    $t->print (CONTENT);
//
// Description
//
//    This is a class.FastTemplate.php3 replacement that provides most of the
//    same interface but has the ability to do nested dynamic templates.  The
//    default is to do dynamic template expansion and no special action is
//    required for this to happen.
//
// class.FastTemplate.php3 Methods Not Implemented
//
//    clear_parse
//   &