From 51fc0daae3193bf55c498a10573abca7770098e4 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Thu, 6 Feb 2014 09:07:17 -0500 Subject: [PATCH] Change the order of templates passed to twig I found that when using multiple themes the order of the template locations passed twig would cause loading of the default them even if I'd specified an alternate theme. '''$this->twiggy->theme('homepage')->display('welcome');''' '''Unable to find template "_layouts/index.html.twig" (looked into: application/themes/default, application/themes/default, application/themes/homepage).''' --- libraries/Twiggy.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/Twiggy.php b/libraries/Twiggy.php index 7e99355..f873d91 100644 --- a/libraries/Twiggy.php +++ b/libraries/Twiggy.php @@ -485,6 +485,8 @@ private function _set_template_locations($theme) // Reset the paths if needed. if(is_object($this->_twig_loader)) { + //lets make twig check our themes before falling back to the default. + $this->_template_locations = array_reverse($this->_template_locations); $this->_twig_loader->setPaths($this->_template_locations); } } @@ -583,4 +585,4 @@ public function __get($variable) return FALSE; } } -// End Class \ No newline at end of file +// End Class