Property | Type | Description | |
---|---|---|---|
$block_tag_regex | @block_name | ||
$blocks | Content "blocks" in template files | ||
$data | Name/value pairing of data tags available to templates | ||
$data_tags_delimiters | Data tag delimiters | ||
$default_namespace | Namespace to place content in if none is specified | ||
$enable_data_tags | Enable data tag search and replace | ||
$layout | |||
$layouts | Layout template to use | ||
$templates_path |
Method | Description | |
---|---|---|
__construct ( ) : Object | Create an instance of the Content class | |
__get ( String $name ) : Mixed | Getter method for returning a data item | |
__toString ( ) : String | Return data values as string | |
add ( String $name, Mixed $content, boolean $append = true ) | Add content under the namespace By default append to any existing data item with same namespace | |
addBlock ( String $block_name, String $content ) | Add a content block under a specified namespace | |
addToView ( |
Merge content blocks for this instance with passed instance | |
clear ( ) | Clear all content block namespaces and data | |
getBlocks ( ) : Array | Get all currently parsed content blocks | |
getData ( ) : Array | Get all the data currently loaded | |
getLayout ( $layout_name = null ) | * Get the relative path to a layout file. Default is layout set with setLayout(). | |
multiadd ( Array $name_vals, String $prefix = null ) | Add multiple content under multiple namespaces Optionally provide a prefix to be prepended to each namespace name | |
parseBlocks ( String $tpl ) : integer | Parse a template into content block namespaces if content block identifiers are present | |
processTemplate ( String $tpl, boolean $parse = true ) : String | Load and process a content template, optionally parse content blocks into namespaces | |
replaceDataTags ( String &$tpl ) : String | Search and replace data tags in templates Allows usage of {{:data}} tags to output data instead of having to use | |
setLayout ( $layout_name ) | * Set the layout to use for output. Name must match one set with setLayouts(). | |
setLayouts ( $layouts, $default = null ) | * Load the list of layouts. An associative array where the key is the layout name and the value is the relative path to the layout file from the templates directory. | |
setTemplatesPath ( String $path ) | Path to templates directory. Use as a prefix when referencing templates and layouts. | |
stripDataTags ( &$tpl ) |
public __construct ( ) : Object | ||
return | Object | instance of Content class |
public __get ( String $name ) : Mixed | ||
$name | String | Name of the data item to return |
return | Mixed | value of the data item |
public __toString ( ) : String | ||
return | String | values of data items delimited with line feeds |
public addBlock ( String $block_name, String $content ) | ||
$block_name | String | namespace to add content block under |
$content | String | content to add |
public getBlocks ( ) : Array | ||
return | Array | associative array of content blocks |
public getData ( ) : Array | ||
return | Array | associative array of loaded data |
public getLayout ( $layout_name = null ) | ||
$layout_name | name of layout |
public multiadd ( Array $name_vals, String $prefix = null ) | ||
$name_vals | Array | array of name/value pairs to add |
$prefix | String | prefix to prepend to each namespace name |
public parseBlocks ( String $tpl ) : integer | ||
$tpl | String | template to parse |
return | integer | number of content blocks discovered |
public processTemplate ( String $tpl, boolean $parse = true ) : String | ||
$tpl | String | template file to include |
$parse | boolean | whether to parse the template blocks into namespaces (default true) |
return | String | the processed template or the number of content blocks parsed |
public replaceDataTags ( String &$tpl ) : String | ||
$tpl | String | template text to search and replace data tags on |
return | String | the processed template with data tags replaced |
public setLayout ( $layout_name ) | ||
$layout_name | name of layout |
public setLayouts ( $layouts, $default = null ) | ||
$layouts | associative array of layouts names and relative paths | |
$default | name of layout to set as default |
public setTemplatesPath ( String $path ) | ||
$path | String | valid directory path |
public $default_namespace |