TemplateLoader
- Type
- Class
- Namespace
- Craft
- Inherits
- Craft\TemplateLoader
- Implements
Twig_ExistsLoaderInterface
,Twig_LoaderInterface
- Since
- 1.0
Loads Craft templates into Twig.
See also http://craftcms.com
View source (opens new window)
# Public Methods
Method | Description |
---|---|
exists() | Checks if a template exists. |
getCacheKey() | Gets the cache key to use for the cache for a given template. |
getSource() | Gets the source code of a template. |
isFresh() | Returns whether the cached template is still up-to-date with the latest template. |
# exists()
Checks if a template exists.
View source (opens new window)
Arguments
$name
(string (opens new window))
Returns
Signature
public boolean exists ( $name )
# getCacheKey()
Gets the cache key to use for the cache for a given template.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The name of the template to load, or a StringTemplate object.
Returns
string (opens new window) – The cache key (the path to the template)
Signature
public string getCacheKey ( $name )
# getSource()
Gets the source code of a template.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The name of the template to load, or a StringTemplate object.
Returns
string (opens new window) – The template source code.
Throws
Signature
public string getSource ( $name )
# isFresh()
Returns whether the cached template is still up-to-date with the latest template.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The template name, or a StringTemplate object.$time
(integer (opens new window)) – The last modification time of the cached template
Returns
Signature
public boolean isFresh ( $name, $time )