[PHPLIB-DEV] cvs commit From: kk (phplib-dev <email protected>)
Date: 10/24/99

From: kk
Date: Sun Oct 24 15:29:36 1999
Added files:
      php-lib/doc/sgml/04-template.sgml

Modified files:
      php-lib/CHANGES
      php-lib/doc/sgml/documentation.sgml
      php-lib/php/template.inc

Log message:
- Some small fixes to Template, a final API change.
- Documentation to Template.

- Is anybody using tpl_form? strings2? tree? query_sql?
  tmpl_table?
- Is anybody actively developing the BLOB API? Documentation?

Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.108 php-lib/CHANGES:1.109
--- php-lib/CHANGES:1.108 Sun Oct 24 14:15:19 1999
+++ php-lib/CHANGES Sun Oct 24 15:29:33 1999
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.108 1999/10/24 12:15:19 kk Exp $
+$Id: CHANGES,v 1.109 1999/10/24 13:29:33 kk Exp $
 
 24-Oct-1999 kk
   - Documentation update, prepare for armageddon
@@ -9,7 +9,7 @@
   - Took Massimilianos auth code, because it is cleaner and
     straighter that what we had before.
   - db_mssql.inc: Auto_Free spelling fix.
-
+ - Template class documented.
 
 22-Oct-1999 kk
   - New method is_registered() for Session class.
Index: php-lib/doc/sgml/documentation.sgml
diff -u php-lib/doc/sgml/documentation.sgml:1.5 php-lib/doc/sgml/documentation.sgml:1.6
--- php-lib/doc/sgml/documentation.sgml:1.5 Sun Oct 24 14:15:20 1999
+++ php-lib/doc/sgml/documentation.sgml Sun Oct 24 15:29:34 1999
@@ -30,6 +30,7 @@
 
   <!ENTITY f04extended SYSTEM "04-extended.sgml">
   <!ENTITY f04cart SYSTEM "04-cart.sgml">
+ <!ENTITY f04template SYSTEM "04-template.sgml">
 
   <!ENTITY f05widget SYSTEM "05-widget.sgml">
   <!ENTITY f05sqlquery SYSTEM "05-sql_query.sgml">
@@ -41,7 +42,7 @@
 
   <!ENTITY f06ack SYSTEM "06-ack.sgml">
 ]>
-<!-- $Id: documentation.sgml,v 1.5 1999/10/24 12:15:20 kk Exp $ -->
+<!-- $Id: documentation.sgml,v 1.6 1999/10/24 13:29:34 kk Exp $ -->
 
 <article>
 <title>PHP Base Library Documentation, Release phplib_7
@@ -49,7 +50,7 @@
 <author>Boris Erdmann, be <email protected>,
         Kristian Köhntopp, kk <email protected>
     and Sascha Schumann, sascha <email protected>
-<date>$Id: documentation.sgml,v 1.5 1999/10/24 12:15:20 kk Exp $
+<date>$Id: documentation.sgml,v 1.6 1999/10/24 13:29:34 kk Exp $
 
 <toc>
 
@@ -83,6 +84,7 @@
 
 &f04extended;
 &f04cart;
+&f04template;
 
 &f05widget;
 &f05sqlquery;
Index: php-lib/php/template.inc
diff -u php-lib/php/template.inc:1.3 php-lib/php/template.inc:1.4
--- php-lib/php/template.inc:1.3 Sun Oct 24 12:21:24 1999
+++ php-lib/php/template.inc Sun Oct 24 15:29:34 1999
@@ -5,7 +5,7 @@
  * (C) Copyright 1999 NetUSE GmbH
  * Kristian Koehntopp
  *
- * $Id: template.inc,v 1.3 1999/10/24 10:21:24 kk Exp $
+ * $Id: template.inc,v 1.4 1999/10/24 13:29:34 kk Exp $
  *
  */
 
@@ -42,9 +42,9 @@
    * root: template directory.
    * unknowns: how to handle unknown variables.
    */
- function Template($root = ".", $unknowns = "keep") {
- $this->root = $root;
- $this->unknowns = $unknowns;
+ function Template($root = ".", $unknowns = "remove") {
+ $this->set_root($root);
+ $this->set_unknowns($unknowns);
   }
 
   /* public: setroot(pathname $root)
@@ -89,15 +89,17 @@
     }
   }
 
- /* public: set_dynamic(string $handle, string $name, string $parent)
+ /* public: set_block(string $parent, string $handle, string $name = "")
    * extract the template $handle from $parent,
    * place variable {$name} instead.
    */
- function set_dynamic($handle, $name, $parent) {
+ function set_block($parent, $handle, $name = "") {
     if (!$this->loadfile($parent)) {
       $this->halt("subst: unable to load $parent.");
       return false;
     }
+ if ($name == "")
+ $name = $handle;
 
     $str = $this->get_var($parent);
     $reg = "/<!--\s+BEGIN $handle\s+-->(.*)<!--\s+END $handle\s+-->/sm";
@@ -209,6 +211,8 @@
       while(list($k, $v) = each($varname)) {
         $result[$k] = $this->varvals[$k];
       }
+
+ return $result;
     }
   }
   
@@ -258,7 +262,7 @@
     return $str;
   }
 
- /* public: print(string $varname)
+ /* public: p(string $varname)
    * varname: name of variable to print.
    */
   function p($varname) {

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.