Class miTemplateParser

Description

Parses templates

  • copyright: Mirchev Ideas Ltd. © 2003, 2004

Located in /util/TemplateParser.inc (line 20)


	
			
Method Summary
 void assign (string $name, string $value)
 void assignArray (array $pairs)
 void assignList (array $keys, array $values)
 mixed &get (string $name)
 string stringTemplateParse (string $contents, [int $iter = 1])
 void templateAdd (String $filename)
 string &templateParse ()
 void templateSetAlternating (mixed $filename1, mixed $filename2, [int $iter = 1], string $filename)
 void templateSetCallback (callback $funcname, [int $iter = 1])
 void templateSetNormal (string $filename, [int $iter = 1])
 void templateShow ()
Methods
assign (line 182)

Assigns a variable to be replaced

void assign (string $name, string $value)
  • string $name: variable name, usually %%VAR_NAME%%
  • string $value: the contents of the variable. usually escaped with htmlenities()
assignArray (line 193)

Assigns a array of variables to be replaced

void assignArray (array $pairs)
  • array $pairs: variable name is the key, the contents is the value
assignList (line 206)

Assigns a list of variables. Both array should have equal sizes, as counted by count() The first variable in the list is assigned the first value, the second variable, the seoncd value, and so on

void assignList (array $keys, array $values)
  • array $keys: the keys with the variable names
  • array $values: the values
get (line 222)

Retrieves an assigned variable value

  • return: the value of the variable
mixed &get (string $name)
  • string $name: the name of the variable
stringTemplateParse (line 153)

Parses the contents param as a string, $iter times, and returns the result

  • return: the parsed contents
string stringTemplateParse (string $contents, [int $iter = 1])
  • string $contents
  • int $iter
templateAdd (line 52)

Adds a template to the list of templates

void templateAdd (String $filename)
  • String $filename
templateParse (line 110)

Parses the template(s) and returns the result

  • return: the parsed contents
string &templateParse ()
templateSetAlternating (line 82)

Sets alternating style of template parsing. It will repeat the template given $iter times, alternating between the first and second template with each row

void templateSetAlternating (mixed $filename1, mixed $filename2, [int $iter = 1], string $filename)
  • string $filename: the template filename
  • int $iter: number of itertaions, 1 by default
templateSetCallback (line 98)

Sets a custom template chaning scheme. The callback function will be called with the number of the row, and this template parser object, and it should return the template content as a string

void templateSetCallback (callback $funcname, [int $iter = 1])
  • callback $funcname: the callback function name. if method use array($object, $method)
  • int $iter: number of iterations, 1 is the default
templateSetNormal (line 67)

Sets normal style of template parsing. It will repeat the template given $iter times

void templateSetNormal (string $filename, [int $iter = 1])
  • string $filename: the template filename
  • int $iter: number of itertaions, 1 by default
templateShow (line 140)

Shows the parsed template

void templateShow ()

Documentation generated on Mon, 18 Oct 2004 14:58:32 +0300 by phpDocumentor 1.2.3