PhpEngine
class PhpEngine implements EngineInterface, ArrayAccess
PhpEngine is an engine able to render PHP templates.
Properties
protected | $loader | ||
protected | $current | ||
protected HelperInterface[] | $helpers | ||
protected | $parents | ||
protected | $stack | ||
protected | $charset | ||
protected | $cache | ||
protected | $escapers | ||
static protected | $escaperCache | ||
protected | $globals | ||
protected | $parser |
Methods
No description
Returns true if this class is able to render the given template.
Gets a helper value.
Returns true if the helper is defined.
Removes a helper.
Adds some helpers.
Sets the helpers.
Returns true if the helper if defined.
Gets a helper value.
Decorates the current template with another one.
Escapes a string by using the current charset.
Sets the charset to use.
Gets the current charset.
Adds an escaper for the given context.
Gets an escaper for a given context.
No description
Returns the assigned globals.
Initializes the built-in escapers.
Gets the loader associated with this engine.
Details
string
render(string|TemplateReferenceInterface $name, array $parameters = array())
Renders a template.
bool
supports(string|TemplateReferenceInterface $name)
Returns true if this class is able to render the given template.
protected string|false
evaluate(Storage $template, array $parameters = array())
Evaluates a template.
string
escape(mixed $value, string $context = 'html')
Escapes a string by using the current charset.
protected
initializeEscapers()
Initializes the built-in escapers.
Each function specifies a way for applying a transformation to a string passed to it. The purpose is for the string to be "escaped" so it is suitable for the format it is being displayed in.
For example, the string: "It's required that you enter a username & password.\n" If this were to be displayed as HTML it would be sensible to turn the ampersand into '&' and the apostrophe into '&aps;'. However if it were going to be used as a string in JavaScript to be displayed in an alert box it would be right to leave the string as-is, but c-escape the apostrophe and the new line.
For each function there is a define to avoid problems with strings being incorrectly specified.