PHP Class Habari\TemplateEngine

The TemplateEngine is an abstract base class to allow any template engine to supply templates for the UI. For an example implementation, see RawPHPEngine or SmartyEngine
Mostrar archivo Open project: habari/system

Protected Properties

Property Type Description
$template_dir directory where the template resides

Public Methods

Method Description
__construct ( )
__get ( string $key ) Tries to retrieve a variable from the internal array engine_vars.
__isset ( string $key ) Detects if a variable is assigned to the template engine for use in constructing the template's output.
__set ( string $key, mixed $value ) Assigns a variable to the template engine for use in constructing the template's output.
__unset ( string $key ) Unassigns a variable to the template engine.
add_template ( string $name, string $file, boolean $replace = false ) Add a template to the list of available templates
append ( string $key, mixed $value = '' ) Appends to an existing variable more values
assign ( string $key, mixed $value = '' ) Assigns a variable to the template engine for use in constructing the template's output.
assigned ( string $key ) Detects if a variable is assigned to the template engine for use in constructing the template's output.
clear ( ) Clear all of the assigned values
display ( string $template ) A function which outputs the result of a transposed template to the output stream
fetch ( string $template ) A function which returns the content of the transposed template as a string
queue_dirs ( array $dirs ) Queue directories to be scanned for template files
template_exists ( string $template ) Returns the existance of the specified template name

Method Details

__construct() abstract public method

abstract public __construct ( )

__get() abstract public method

Method returns the value if succesful, returns false otherwise.
abstract public __get ( string $key )
$key string name of variable

__isset() abstract public method

Detects if a variable is assigned to the template engine for use in constructing the template's output.
abstract public __isset ( string $key )
$key string name of variable

__set() abstract public method

Assigns a variable to the template engine for use in constructing the template's output.
abstract public __set ( string $key, mixed $value )
$key string name of variable
$value mixed value of variable

__unset() abstract public method

Unassigns a variable to the template engine.
abstract public __unset ( string $key )
$key string name of variable

add_template() abstract public method

Add a template to the list of available templates
abstract public add_template ( string $name, string $file, boolean $replace = false )
$name string Name of the new template
$file string File of the template to add
$replace boolean If true, replace any existing template with this name

append() abstract public method

Appends to an existing variable more values
abstract public append ( string $key, mixed $value = '' )
$key string name of variable
$value mixed value of variable

assign() abstract public method

Assigns a variable to the template engine for use in constructing the template's output.
abstract public assign ( string $key, mixed $value = '' )
$key string name of variable
$value mixed value of variable

assigned() abstract public method

Detects if a variable is assigned to the template engine for use in constructing the template's output.
abstract public assigned ( string $key )
$key string name of variable

clear() abstract public method

Clear all of the assigned values
abstract public clear ( )

display() abstract public method

A function which outputs the result of a transposed template to the output stream
abstract public display ( string $template )
$template string Name of template to display

fetch() abstract public method

A function which returns the content of the transposed template as a string
abstract public fetch ( string $template )
$template string Name of template to fetch

queue_dirs() abstract public method

Queue directories to be scanned for template files
abstract public queue_dirs ( array $dirs )
$dirs array An array of directories to scan for templates

template_exists() abstract public method

Returns the existance of the specified template name
abstract public template_exists ( string $template )
$template string Name of template to detect

Property Details

$template_dir protected_oe property

directory where the template resides
protected $template_dir