PHP Class core\Template

Show file Open project: sendya/shadowsocks-panel Class Usage Examples

Public Methods

Method Description
getContext ( )
getPath ( string $templateName ) : string Get template file path
getView ( )
load ( string $templateName, array $context = [] ) : string Load a template from data folder, compile it if it is outdated or not exists
parseLoop ( $match )
parseUrlRewrite ( $match )
putContext ( $name, $value, $escapeType = Escape::TEXT_RECURSIVE )
render ( )
setContext ( $context = [] )
setView ( $viewName )

Private Methods

Method Description
compile ( $templateName )
createDir ( $dir, $permission = 511 )
pregGet ( $subject, $pattern, $offset = 1 )

Method Details

getContext() public static method

public static getContext ( )

getPath() public static method

Get template file path
public static getPath ( string $templateName ) : string
$templateName string Template file name
return string Absolute path of the template file

getView() public static method

public static getView ( )

load() public static method

Load a template from data folder, compile it if it is outdated or not exists
Deprecation: Please use setView(), putContext(), render()
public static load ( string $templateName, array $context = [] ) : string
$templateName string
$context array
return string

parseLoop() public static method

public static parseLoop ( $match )

parseUrlRewrite() public static method

public static parseUrlRewrite ( $match )

putContext() public static method

public static putContext ( $name, $value, $escapeType = Escape::TEXT_RECURSIVE )

render() public static method

public static render ( )

setContext() public static method

public static setContext ( $context = [] )

setView() public static method

public static setView ( $viewName )