Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Allow multiple view directories for Smarty #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Smarty.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down