|
Tv2 documentation | |||||
PREV NEXT | FRAMES NO FRAME | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ctlViewService
ctlTpl template engine.
Change logs |
2003-07-07 Full code comments |
2003-07-21 Added method loadLibrary() |
2003-07-24 Added checking if templates exist by Linas Gricius linas@gricius.net |
2003-08-04 Added method checkVars |
2003-08-04 Fixed bug with quieting down fatal errors in methods process() and template(). |
2003-08-04 Fixed constructor comments |
Field Summary | |
private boolean | $cie Variable used to enable/disable checking if template exists or not. |
private integer | $e Stores PHP error reporting level while parsing |
private string | $file Template filename |
private mixed | $k Temporary variable used while parsing (stores var values). |
private string | $tpl_dir Stores default temlpate directory name |
private string | $v Temporary variable used while parsing (stores var names). |
private array | $vars Template variable storage |
Constructor Summary | |
void | ctlTpl([string $td], [boolean $cie]) Constructor. |
Method Summary | |
private void | checkTpl(string $filename) Checks if template exists or not. |
boolean | checkVars(mixed $var_names) Checks if template var[s] exist |
void | clearVars() Clears all stored template vars |
void | loadLibrary(string $filename) Loads a function library |
string | process(string $file, [boolean $clr_vars]) Parses the given template file and clears vars if needed. |
void | regVar(string $name, mixed& $var) Registers a reference to an external variable as a tpl var: |
void | setVar(string $name, mixed $value) Creates/changes template var value |
void | setVars(array $array) Creates/changes multiple template variables |
string | template(string $file, [string $myname], [boolean $clr_vars]) Includes the result from the template script that is being parsed now into template specified by $name. |
void | unsetAllVars() Alias of ctlTpl::clearVars. |
void | unsetVar(string $name) Clears a variable |
Field Detail |
private boolean $cie
Variable used to enable/disable checking if template exists or not.
private integer $e
Stores PHP error reporting level while parsing
private string $file
Template filename
private mixed $k
Temporary variable used while parsing (stores var values).
private string $tpl_dir
Stores default temlpate directory name
private string $v
Temporary variable used while parsing (stores var names).
private array $vars
Template variable storage
Constructor Detail |
void ctlTpl([string $td], [boolean $cie])
Constructor. Sets default template directory and clears vars array.
td
- default template directory (default value './' -- current directory)cie
- enable checking if template exists or notMethod Detail |
private void checkTpl(string $filename)
Checks if template exists or not.
filename
- function library nameboolean checkVars(mixed $var_names)
Checks if template var[s] exist
var_names
- variable name array or variable name stringvoid clearVars()
Clears all stored template vars
void loadLibrary(string $filename)
Loads a function library
filename
- function library namestring process(string $file, [boolean $clr_vars])
Parses the given template file and clears vars if needed.
file
- template file name (relative to default template dir or absolute).clr_vars
- should the variables be cleared after parsing? Default: FALSE.void regVar(string $name, mixed& $var)
Registers a reference to an external variable as a tpl var:
name
- variable namevar
- variable referencevoid setVar(string $name, mixed $value)
Creates/changes template var value
name
- variable namevalue
- variable valuevoid setVars(array $array)
Creates/changes multiple template variables
array
- variable array. Format should be: array('varname1'=>'value1', 'varname2'=>'value2', ...).string template(string $file, [string $myname], [boolean $clr_vars])
Includes the result from the template script that is being parsed now into template specified by $name. The result is stored in a variable specified by $myname. NOTICE: this method should be called AT THE END of any template script.
file
- template file name (relative to default template dir or absolute).myname
- variable name for included text.clr_vars
- should the variables be cleared after parsing? Default: FALSE.void unsetAllVars()
Alias of ctlTpl::clearVars.
void unsetVar(string $name)
Clears a variable
name
- variable name
|
Tv2 documentation | |||||
PREV NEXT | FRAMES NO FRAME | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)