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:
fabien
2009-10-14 05:12:46 +00:00
parent 203af9a649
commit f601832cf9
+20 -10
View File
@@ -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.
*