*/
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);
}
}
/**
+ * 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.
*
* @param string $name string The name of the template to load