Twig API
Class

Twig_Loader_Chain

class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface

Loads templates from other loaders.

Methods

__construct(array $loaders = array())

Constructor.

addLoader(Twig_LoaderInterface $loader)

Adds a loader instance.

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 27
public __construct(array $loaders = array())

Constructor.

Parameters

array $loaders An array of loader instances

at line 40
public addLoader(Twig_LoaderInterface $loader)

Adds a loader instance.

Parameters

Twig_LoaderInterface $loader A Loader instance

at line 49
public string getSource(string $name)

Gets the source code of a template, given its name.

Parameters

string $name The name of the template to load

Return Value

string The template source code

Exceptions

Twig_Error_Loader When $name is not found

at line 70
public boolean exists(string $name)

Check if we have the source code of a template, given its name.

Parameters

string $name The name of the template to check if we can load

Return Value

boolean If the template source code is handled by this loader or not

at line 97
public string getCacheKey(string $name)

Gets the cache key to use for the cache for a given template name.

Parameters

string $name The name of the template to load

Return Value

string The cache key

Exceptions

Twig_Error_Loader When $name is not found

at line 118
public Boolean isFresh(string $name, timestamp $time)

Returns true if the template is still fresh.

Parameters

string $name The template name
timestamp $time The last modification time of the cached template

Return Value

Boolean true if the template is fresh, false otherwise

Exceptions

Twig_Error_Loader When $name is not found