class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
Loads a template from an array.
When using this loader with a cache mechanism, you should know that a new cache
key is generated each time a template content "changes" (the cache key being the
source code of the template). If you don't want to see your cache grows out of
control, you need to take care of clearing the old cache file by yourself.
Methods
|
__construct(array $templates)
Constructor. |
||
|
setTemplate(string $name, string $template)
Adds or overrides a template. |
||
| string |
getSource(string $name)
Gets the source code of a template, given its name. |
|
| boolean |
exists(string $name)
Check if we have the source code of a template, given its name. |
|
| string |
getCacheKey(string $name)
Gets the cache key to use for the cache for a given template name. |
|
| Boolean |
isFresh(string $name, timestamp $time)
Returns true if the template is still fresh. |
Details
at line 33
public
__construct(array $templates)
Constructor.
at line 47
public
setTemplate(string $name, string $template)
Adds or overrides a template.
at line 55
public string
getSource(string $name)
Gets the source code of a template, given its name.
at line 68
public boolean
exists(string $name)
Check if we have the source code of a template, given its name.
at line 76
public string
getCacheKey(string $name)
Gets the cache key to use for the cache for a given template name.
at line 89
public Boolean
isFresh(string $name, timestamp $time)
Returns true if the template is still fresh.