This commit is contained in:
flash 2015-03-08 06:52:28 +01:00
parent bf23e17a00
commit 744b75432e

View file

@ -9,8 +9,6 @@ class Flashii {
public $_TPL; public $_TPL;
public $_MD; public $_MD;
public static $_CNF;
public static $_TPLPUBPATH;
// Constructor // Constructor
function __construct($config) { function __construct($config) {
@ -48,16 +46,14 @@ class Flashii {
} }
// Initialise Twig // Initialise Twig
private function initTwig($templateName = null) { private function initTwig($templateName = null, $templatesFolder = null) {
// Assign default values set in the configuration if $templateName and $templatesFolder are null // Assign default values set in the configuration if $templateName and $templatesFolder are null
$templateName = is_null($templateName) ? Configuration::getConfig('template') : $templateName; $templateName = is_null($templateName) ? self::getConfig('etc', 'design') : $templateName;
$templatesFolder = is_null($templatesFolder) ? self::getConfig('etc', 'templatesPath') : $templatesFolder;
// Set variable for public access
self::$_TPLPUBPATH = 'http'. (isset($_SERVER['HTTPS']) ? 's' : '') .'://'. $_SERVER['SERVER_NAME'] . '/templates/'. $templateName;
// Initialise Twig Filesystem Loader // Initialise Twig Filesystem Loader
$twigLoader = new \Twig_Loader_Filesystem(ROOT_DIRECTORY .'templates/'. $templateName .'/templates'); $twigLoader = new \Twig_Loader_Filesystem($templatesFolder . $templateName);
// And now actually initialise the templating engine // And now actually initialise the templating engine
$this->_TPL = new \Twig_Environment($twigLoader, array( $this->_TPL = new \Twig_Environment($twigLoader, array(