diff --git a/Smarty.php b/Smarty.php index fcf5101..52ceb85 100644 --- a/Smarty.php +++ b/Smarty.php @@ -73,6 +73,22 @@ class Smarty extends \Slim\View */ private $parserInstance = null; + /** + * Set the base directory that contains view templates + * @param string|array $directory + * @throws \InvalidArgumentException If directory is not a directory + */ + public function setTemplatesDirectory($directory) + { + if (is_array($directory)) { + $this->templatesDirectory = array_map(function($element) { + return rtrim($element, DIRECTORY_SEPARATOR); + }, $directory); + } else { + $this->templatesDirectory = rtrim($directory, DIRECTORY_SEPARATOR); + } + } + /** * Render Template *