mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 04:16:28 +00:00
added a setPaths() method to the filesystem loader
git-svn-id: http://svn.twig-project.org/trunk@39 93ef8e89-cb99-4229-a87c-7fa0fa45744b
This commit is contained in:
@@ -31,16 +31,7 @@ class Twig_Loader_Filesystem extends Twig_Loader
|
||||
*/
|
||||
public function __construct($paths, $cache = null, $autoReload = true)
|
||||
{
|
||||
if (!is_array($paths))
|
||||
{
|
||||
$paths = array($paths);
|
||||
}
|
||||
|
||||
$this->paths = array();
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
$this->paths[] = realpath($path);
|
||||
}
|
||||
$this->setPaths($paths);
|
||||
|
||||
parent::__construct($cache, $autoReload);
|
||||
}
|
||||
@@ -55,6 +46,25 @@ class Twig_Loader_Filesystem extends Twig_Loader
|
||||
return $this->paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the paths where templates are stored.
|
||||
*
|
||||
* @param string|array $paths A path or an array of paths where to look for templates
|
||||
*/
|
||||
public function setPaths($paths)
|
||||
{
|
||||
if (!is_array($paths))
|
||||
{
|
||||
$paths = array($paths);
|
||||
}
|
||||
|
||||
$this->paths = array();
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
$this->paths[] = realpath($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source code of a template, given its name.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user