PHP 클래스 GiTemplate, atk4

- completely remove any code from templates - speed up template parsing and manipulation speed
저자: Romans ([email protected])
상속: extends AbstractModel, implements ArrayAccess
파일 보기 프로젝트 열기: atk4/atk4

공개 프로퍼티들

프로퍼티 타입 설명
$default_exception string
$origin_filename Which file template is loaded from.
$settings array Settings are populated from the configuration file, if found.
$tags array This array contains list of all tags found inside template implementing faster access when manipulating the template.
$template array This is a parsed contents of the template organized inside an array. This structure makes it very simple to modify any part of the array.
$template_file
$template_source
$template_type
$top_tags

공개 메소드들

메소드 설명
__clone ( )
_getDumpTags ( &$template )
append ( $tag, $value, $encode = true ) Add more content inside a tag.
appendHTML ( $tag, $value )
cloneRegion ( $tag )
del ( $tag ) Empty contents of specified region. If region contains sub-hierarchy, it will be also removed.
dumpTags ( )
eachTag ( $tag, $callable )
exception ( string $message = 'Undefined Exception', string $type = null, string $code = null ) : Exception_Template Returns relevant exception class. Use this method with "throw".
findTemplate ( $template_name ) template loading and parsing
get ( $tag ) Get value of the tag. Note that this may contain an array if tag contains a structure.
getDefaultSettings ( ) This function specifies default settings for SMlite.
getTagRef ( $tag, &$template ) This is a helper method which populates an array pointing to the place in the template referenced by a said tag.
getTagRefList ( $tag, &$template ) For methods which execute action on several tags, this method will return array of templates. You can then iterate through the array and update all the template values.
hasTag ( $tag ) Checks if template has defined a specified tag.
init ( ) Template creation, interface functions
isTopTag ( string $tag ) : boolean Returns true if specified tag is a top-tag of the template.
is_set ( $tag ) Obsolete due to inconsistent naming.
loadTemplate ( $template_name, $ext = null )
loadTemplateFromString ( string $str ) Initialize current template from the supplied string.
offsetExists ( $name ) {{{ ArrayAccess support
offsetGet ( $name )
offsetSet ( $name, $val )
offsetUnset ( $name )
parseTemplate ( $str )
parseTemplateRecursive ( &$input, &$template )
rebuildTags ( )
rebuildTagsRegion ( &$template )
recursiveRender ( &$template )
regTag ( $tag )
reload ( ) Causes the template to be refreshed from it's original source
render ( $region = null )
renderRegion ( &$chunk )
set ( $tag, $value = null, $encode = true ) This function will replace region refered by $tag to a new content.
setHTML ( $tag, $value = null )
tryDel ( $tag ) Similar to del() but won't throw exception if tag is not present.
trySet ( $tag, $value = null, $encode = true ) Check if tag is present inside template. If it does, execute set(); See documentation for set().
trySetHTML ( $tag, $value = null ) Attempt to set value of a tag to a HTML variable. The value is inserted as-is, while regular set() would HTML-encode the values to avoid injection.

메소드 상세

__clone() 공개 메소드

public __clone ( )

_getDumpTags() 공개 메소드

public _getDumpTags ( &$template )

append() 공개 메소드

Add more content inside a tag.
public append ( $tag, $value, $encode = true )

appendHTML() 공개 메소드

public appendHTML ( $tag, $value )

cloneRegion() 공개 메소드

public cloneRegion ( $tag )

del() 공개 메소드

TODO: This does not dispose of the tags which were previously inside the region. This causes some severe pitfalls for the users and ideally must be checked and proper errors must be generated.
public del ( $tag )

dumpTags() 공개 메소드

public dumpTags ( )

eachTag() 공개 메소드

public eachTag ( $tag, $callable )

exception() 공개 메소드

Returns relevant exception class. Use this method with "throw".
public exception ( string $message = 'Undefined Exception', string $type = null, string $code = null ) : Exception_Template
$message string Static text of exception.
$type string Exception class or class postfix
$code string Optional error code
리턴 Exception_Template

findTemplate() 공개 메소드

template loading and parsing
public findTemplate ( $template_name )

get() 공개 메소드

Get value of the tag. Note that this may contain an array if tag contains a structure.
public get ( $tag )

getDefaultSettings() 공개 메소드

This function specifies default settings for SMlite.
public getDefaultSettings ( )

getTagRef() 공개 메소드

Because there might be multiple tags and getTagRef is returning only one template, it will return the first occurence: {greeting}hello{/}, {greeting}world{/} calling getTagRef('greeting',$template) will point second argument towards &array('hello');
public getTagRef ( $tag, &$template )

getTagRefList() 공개 메소드

{greeting}hello{/}, {greeting}world{/} calling getTagRefList('greeting',$template) will point second argument towards array(&array('hello'),&array('world')); If $tag is specified as array, then $templates will contain all occurences of all tags from the array.
public getTagRefList ( $tag, &$template )

hasTag() 공개 메소드

Checks if template has defined a specified tag.
public hasTag ( $tag )

init() 공개 메소드

Template creation, interface functions
public init ( )

isTopTag() 공개 메소드

Since Agile Toolkit 4.3 this tag is always called _top
public isTopTag ( string $tag ) : boolean
$tag string
리턴 boolean

is_set() 공개 메소드

Obsolete due to inconsistent naming.
public is_set ( $tag )

loadTemplate() 공개 메소드

public loadTemplate ( $template_name, $ext = null )

loadTemplateFromString() 공개 메소드

Initialize current template from the supplied string.
public loadTemplateFromString ( string $str )
$str string

offsetExists() 공개 메소드

{{{ ArrayAccess support
public offsetExists ( $name )

offsetGet() 공개 메소드

public offsetGet ( $name )

offsetSet() 공개 메소드

public offsetSet ( $name, $val )

offsetUnset() 공개 메소드

public offsetUnset ( $name )

parseTemplate() 공개 메소드

public parseTemplate ( $str )

parseTemplateRecursive() 공개 메소드

public parseTemplateRecursive ( &$input, &$template )

rebuildTags() 공개 메소드

public rebuildTags ( )

rebuildTagsRegion() 공개 메소드

public rebuildTagsRegion ( &$template )

recursiveRender() 공개 메소드

public recursiveRender ( &$template )

regTag() 공개 메소드

public regTag ( $tag )

reload() 공개 메소드

Causes the template to be refreshed from it's original source
public reload ( )

render() 공개 메소드

public render ( $region = null )

renderRegion() 공개 메소드

public renderRegion ( &$chunk )

set() 공개 메소드

If tag is found inside template several times, all occurences are replaced. ALTERNATIVE USE(2) of this function is to pass associative array as a single argument. This will assign multiple tags with one call. Sample use is: set($_GET); would read and set multiple region values from $_GET array.
public set ( $tag, $value = null, $encode = true )

setHTML() 공개 메소드

public setHTML ( $tag, $value = null )

tryDel() 공개 메소드

Similar to del() but won't throw exception if tag is not present.
public tryDel ( $tag )

trySet() 공개 메소드

Check if tag is present inside template. If it does, execute set(); See documentation for set().
public trySet ( $tag, $value = null, $encode = true )

trySetHTML() 공개 메소드

Attempt to set value of a tag to a HTML variable. The value is inserted as-is, while regular set() would HTML-encode the values to avoid injection.
public trySetHTML ( $tag, $value = null )

프로퍼티 상세

$default_exception 공개적으로 프로퍼티

public string $default_exception
리턴 string

$origin_filename 공개적으로 프로퍼티

Which file template is loaded from.
public $origin_filename

$settings 공개적으로 프로퍼티

Settings are populated from the configuration file, if found.
public array $settings
리턴 array

$tags 공개적으로 프로퍼티

This array contains list of all tags found inside template implementing faster access when manipulating the template.
public array $tags
리턴 array

$template 공개적으로 프로퍼티

This is a parsed contents of the template organized inside an array. This structure makes it very simple to modify any part of the array.
public array $template
리턴 array

$template_file 공개적으로 프로퍼티

public $template_file

$template_source 공개적으로 프로퍼티

public $template_source

$template_type 공개적으로 프로퍼티

public $template_type

$top_tags 공개적으로 프로퍼티

public $top_tags