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

Returns

boolean (opens new window)

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

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

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

Returns

boolean (opens new window)

Signature

public boolean isFresh ( $name, $time )