Re: [PHP Template] Re: [PHP3] PHP Template Engine spec revision 0.35
[email protected] (Andrei Zmievski) Thu, 24 Feb 2000 09:51:56 -0600
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 24 Feb 2000, Kristian Köhntopp wrote: > My code is loading a template which has been tampered with by > the designer with a clue deficiency. I want to > > - get a list of all variables used in the template > > $hash = tmpl_variable_list(resource tmpl); > reset($hash); > while(list($k, $v) = each($hash)): > print "variable named $k ist of type $v\n"; > endwhile; > > with $v being either assigned, config or internal. Well, if the engine sees an internal variable it does not recognize it will give a parse error. Otherwise, a function like this could be useful, I suppose. > - check my array values against the template and get a > list of all variables within that template which have > not yet been assigned a value > > $hash = tmpl_variable_unassigned(resource tmpl) > # as above Ok, this can be done. > - define error handling for fetch and print operations: > - unassigned variables are left untouched in the output > - unassigned variables are substituted by HTML comments > <!-- unassigned variable $imanunassignedvariable --> > - unassigned variables are substited by nothing > > define(TMPL_KEEP, 0); > define(TMPL_COMMENT, 1); > define(TMPL_REMOVE, 2); > > tmpl_handle_errors(int mode); There is .ini setting for this, which can be changed with ini_alter(), but I'm thinking of making some tmpl_*() convenience functions for this. -Andrei * On the keyboard of life, always keep one finger on the escape key. *