Class Yapter

Description

Yapter - Yet Another PHP Template Engine

  • since: V3.0.0

Located in /yapter.php (line 58)


	
			
Direct descendents
Class Description
Template Yapter - Yet Another PHP Template Engine (Legacy Class)
Variable Summary
Method Summary
Yapter Yapter (string $file, [int $level = E_YAPTER_ALL])
void addBlock (string $blockname, string $content)
void addBlockDef (string $blockdef, string $content)
void addBlockFromDef (string $blockname, string $blockdef)
void addBlockFromFile (string $blockname, string $file)
void clear (string $blockname)
void error (int $line_num, string $msg)
float execTime ()
string executionTime ()
string|boolean getBlockContent (string $blockname)
string|boolean getContents ([string $blockname = ''])
float getmicrotime ()
string|int|boolean getVar (string $varname)
void getWarningLevel ()
void hide (string $block)
void notice (int $line_num, string $msg)
array parse ([string $blockname = ''])
void prepare (string $blockname)
void replace ( $block, string $replace_by_block, string $blockname)
void set (string $varname, string|int $value)
void setFile (string $varname,  $filename, string $file)
void setHideUnparsedBlocks (boolean $a)
void setIgnoreUnknownVars (boolean $a)
void setMissingVar ( $varname, string $a)
void setVars (array $variables)
void setWarningLevel (int $level)
void spit ()
void warning (int $line_num, string $msg)
void warnVarNotSet (string $varname)
Variables
array $blockDefs = array() (line 97)

Tracks all block definitions from which multiple block instances can be created.

array $blox = array() (line 90)

Template content blocks

$blox[blockname]['content'] holds the template's content $blox[blockname]['numlines'] holds the number of lines in the block $blox[blockname]['parsed'] holds an array with the parsed data $blox[$_ROOT] always holds the main template

boolean $hide_unparsed_blocks (line 79)

Automatically hide unparsed blocks?

boolean $ignore_unknown_vars (line 72)

Ignore unknown variables?

array $missing_var_list (line 126)

Declared variables that were not set.

float $startTime (line 119)

Script start time used to calculate debug execution time.

array $vars (line 104)

Array of variables available to all blocks

string $warning_level (line 112)

Warning level verbosity

string $_ROOT (line 65)

Document Root

Methods
Constructor Yapter (line 136)

Yapter Constructor

Yapter Yapter (string $file, [int $level = E_YAPTER_ALL])
  • string $file: The fully pathed template file
  • int $level: The warning level
addBlock (line 293)

Adds a new block to the blox-array

void addBlock (string $blockname, string $content)
  • string $blockname: The name of the block.
  • string $content: The content of the block.
addBlockDef (line 318)

Adds a block definition to the block-definition array from which other blocks can be copied

void addBlockDef (string $blockdef, string $content)
  • string $blockdef: The name of an existing block.
  • string $content: The content of the block definition.
addBlockFromDef (line 336)

Copies a block from the block definition array

void addBlockFromDef (string $blockname, string $blockdef)
  • string $blockname: The name of the block.
  • string $blockdef: The name of an existing defined block.
addBlockFromFile (line 307)

Adds a new block, filling it with the specified's file contents

void addBlockFromFile (string $blockname, string $file)
  • string $blockname: The name of the block.
  • string $file: The file containing the contents for the block.
clear (line 656)

Resets the parsed data to an empty string and sets the block as "unparsed".

void clear (string $blockname)
  • string $blockname: The name of the block.
error (line 153)

Error handler

void error (int $line_num, string $msg)
  • int $line_num: Line number.
  • string $msg: The error message.
execTime (line 716)

Gets the time in seconds required to parse the template.

float execTime ()
executionTime (line 726)

Gets the debug string with the time required to parse the template.

string executionTime ()
getBlockContent (line 610)

Gets the content of a block.

  • return: The contents of the block or FALSE if unset.
string|boolean getBlockContent (string $blockname)
  • string $blockname: The name of the block.
getContents (line 674)

Gets the parsed content of a block or the ROOT (complete) template.

  • return: The parsed contents of the block or FALSE if unset.
string|boolean getContents ([string $blockname = ''])
  • string $blockname: The name of the block.
getHideUnparsedBlocks (line 242)

Gets weather to hide unparsed template blocks.

boolean getHideUnparsedBlocks ()
getIgnoreUnknownVars (line 222)

Gets weather to ignore unknown template variables.

boolean getIgnoreUnknownVars ()
getmicrotime (line 701)

Get the Unix timestamp in seconds.

float getmicrotime ()
getMissingVarList (line 279)
void getMissingVarList ()
getVar (line 595)

Gets the value of a variable.

  • return: The value of the variable or FALSE if unset.
string|int|boolean getVar (string $varname)
  • string $varname: Template variable name.
getWarningLevel (line 202)

Gets the level of verbosity of error/warning/notices that Yapter displays.

void getWarningLevel ()
hide (line 642)

Hides all the contents of the specified block.

void hide (string $block)
  • string $block: The name of the block.
notice (line 182)

Notice handler

void notice (int $line_num, string $msg)
  • int $line_num: Line number.
  • string $msg: The notice message.
parse (line 450)

Parses the specified block, filling variables and nested blockdefs

  • return: Parsed block
array parse ([string $blockname = ''])
  • string $blockname: The name of the block.
prepare (line 346)

Handles subprocessing of templates found in the main template file

void prepare (string $blockname)
  • string $blockname: The name of the block.
replace (line 625)

Replaces the contents of one block with the contents of another.

void replace ( $block, string $replace_by_block, string $blockname)
  • string $blockname: The name of the block to be replaced.
  • string $replace_by_block: The name of the block to duplicate.
  • $block
set (line 550)

Assigns a value to a variable ({varname}).

void set (string $varname, string|int $value)
  • string $varname: Template variable name.
  • string|int $value: the value of the template variable.
setFile (line 580)

Assigns the contents of a file to a variable ({varname}).

void setFile (string $varname,  $filename, string $file)
  • string $varname: Template variable name.
  • string $file: The file containing the contents for the variable.
  • $filename
setHideUnparsedBlocks (line 232)

Sets weather to hide unparsed template blocks.

void setHideUnparsedBlocks (boolean $a)
  • boolean $a
setIgnoreUnknownVars (line 212)

Sets weather to ignore unknown template variables.

void setIgnoreUnknownVars (boolean $a)
  • boolean $a
setMissingVar (line 265)

List of variables that were found to not be set during parsing.

void setMissingVar ( $varname, string $a)
  • string $a: The name of the unset template variable.
  • $varname
setVars (line 564)

Assigns values to multiple variables

void setVars (array $variables)
  • array $variables: Associative array (var_name => var_value) of template variables.
setWarningLevel (line 194)

Sets the level of verbosity of error/warning/notices that Yapter displays.

void setWarningLevel (int $level)
  • int $level: The warning level
spit (line 690)

Prints the full template contents.

void spit ()
warning (line 169)

Warning handler

void warning (int $line_num, string $msg)
  • int $line_num: Line number.
  • string $msg: The warning message.
warnVarNotSet (line 252)

Issue warning the first time an assigned variable is found, but not set.

void warnVarNotSet (string $varname)
  • string $varname: The name of the unset template variable.

Documentation generated on Tue, 27 Feb 2007 22:01:39 -0500 by phpDocumentor 1.3.1