PHP Class LightnCandy\Partial

显示文件 Open project: zordius/lightncandy Class Usage Examples

Public Properties

Property Type Description
$TMP_JS_FUNCTION_STR

Public Methods

Method Description
compile ( array\arraystring | integer> &$context, string $template ) : string compile a template into a closure function
compileDynamic ( array\arraystring | integer> &$context, string $name ) : string | null compile partial as closure, stored in context
compileStatic ( array\arraystring | integer> &$context, string $name ) : string | null compile a partial to static embed PHP code
handleDynamic ( &$context ) Include all partials when using dynamic partials
read ( array\arraystring | integer> &$context, string $name ) : string | null Read partial file content as string and store in context
resolve ( array\arraystring | integer> &$context, string &$name ) : string | null resolve partial, return the partial content
resolver ( array\arraystring | integer> &$context, string &$name ) : string | null use partialresolver to resolve partial, return the partial content

Protected Methods

Method Description
prePartial ( array\arraystring | integer> &$context, string $tmpl, string &$name ) : string | null preprocess partial template before it be stored into context

Method Details

compile() public static method

compile a template into a closure function
public static compile ( array\arraystring | integer> &$context, string $template ) : string
$context array\arraystring | integer>
$template string template string
return string $code compiled PHP code

compileDynamic() public static method

compile partial as closure, stored in context
public static compileDynamic ( array\arraystring | integer> &$context, string $name ) : string | null
$context array\arraystring | integer>
$name string partial name
return string | null $code compiled PHP code when success

compileStatic() public static method

compile a partial to static embed PHP code
public static compileStatic ( array\arraystring | integer> &$context, string $name ) : string | null
$context array\arraystring | integer>
$name string partial name
return string | null $code PHP code string

handleDynamic() public static method

Include all partials when using dynamic partials
public static handleDynamic ( &$context )

prePartial() protected static method

preprocess partial template before it be stored into context
protected static prePartial ( array\arraystring | integer> &$context, string $tmpl, string &$name ) : string | null
$context array\arraystring | integer>
$tmpl string partial template
$name string partial name
return string | null $content processed partial template

read() public static method

Read partial file content as string and store in context
public static read ( array\arraystring | integer> &$context, string $name ) : string | null
$context array\arraystring | integer>
$name string partial name
return string | null $code compiled PHP code when success

resolve() public static method

resolve partial, return the partial content
public static resolve ( array\arraystring | integer> &$context, string &$name ) : string | null
$context array\arraystring | integer>
$name string partial name
return string | null $content partial content

resolver() public static method

use partialresolver to resolve partial, return the partial content
public static resolver ( array\arraystring | integer> &$context, string &$name ) : string | null
$context array\arraystring | integer>
$name string partial name
return string | null $content partial content

Property Details

$TMP_JS_FUNCTION_STR public_oe static_oe property

public static $TMP_JS_FUNCTION_STR