Overview

Namespaces

  • LightnCandy

Classes

  • Compiler
  • Context
  • Encoder
  • Exporter
  • Expression
  • Flags
  • LightnCandy
  • Parser
  • Partial
  • Runtime
  • SafeString
  • StringObject
  • Token
  • Validator
  • Overview
  • Namespace
  • Class

Class Partial

LightnCandy Partial handler

Namespace: LightnCandy
Located at Partial.php
Methods summary
public static
# handleDynamic( & $context )

Include all partials when using dynamic partials

Include all partials when using dynamic partials

public static string|null
# read( array<string,array|string|integer> & $context, string $name )

Read partial file content as string and store in context

Read partial file content as string and store in context

Parameters

$context
Current context of compiler progress.
$name
partial name

Returns

string|null
$code compiled PHP code when success
protected static string|null
# prePartial( array<string,array|string|integer> & $context, string $tmpl, string & $name )

preprocess partial template before it be stored into context

preprocess partial template before it be stored into context

Parameters

$context
Current context of compiler progress.
$tmpl
partial template
$name
partial name

Returns

string|null
$content processed partial template

Expect

'hey' when input array('prepartial' => false), 'hey', 'haha'
'haha-hoho' when input array('prepartial' => function ($cx, $tmpl, $name) {return "$name-$tmpl";}), 'hoho', 'haha'
public static string|null
# resolve( array<string,array|string|integer> & $context, string & $name )

resolve partial, return the partial content

resolve partial, return the partial content

Parameters

$context
Current context of compiler progress.
$name
partial name

Returns

string|null
$content partial content
public static string|null
# resolver( array<string,array|string|integer> & $context, string & $name )

use partialresolver to resolve partial, return the partial content

use partialresolver to resolve partial, return the partial content

Parameters

$context
Current context of compiler progress.
$name
partial name

Returns

string|null
$content partial content
public static string|null
# compileStatic( array<string,array|string|integer> & $context, string $name )

compile a partial to static embed PHP code

compile a partial to static embed PHP code

Parameters

$context
Current context of compiler progress.
$name
partial name

Returns

string|null
$code PHP code string
public static string|null
# compileDynamic( array<string,array|string|integer> & $context, string $name )

compile partial as closure, stored in context

compile partial as closure, stored in context

Parameters

$context
Current context of compiler progress.
$name
partial name

Returns

string|null
$code compiled PHP code when success
public static string
# compile( array<string,array|string|integer> & $context, string $template, string|integer $name = 0 )

compile a template into a closure function

compile a template into a closure function

Parameters

$context
Current context of compiler progress.
$template
template string
$name
partial name or 0

Returns

string
$code compiled PHP code
Properties summary
public static string $TMP_JS_FUNCTION_STR
# "!!\aFuNcTiOn\a!!"
API documentation generated by ApiGen