From bf4c7f7165d13cd873a1d011b831f5082914ec63 Mon Sep 17 00:00:00 2001 From: "Rafael V. de Oliveira" Date: Wed, 7 Nov 2012 10:37:14 +0000 Subject: [PATCH] Improve compatibility with HMVC approach. You don't have to create folders to views/templates for all your modules. --- libraries/Twiggy.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/Twiggy.php b/libraries/Twiggy.php index dd1096a..29e74f8 100644 --- a/libraries/Twiggy.php +++ b/libraries/Twiggy.php @@ -469,7 +469,11 @@ private function _set_template_locations($theme) foreach($module_locations as $loc => $offset) { - $this->_template_locations[] = $loc . $this->_module . '/' . $this->_config['themes_base_dir'] . $theme; + /* Only add the template location if the same exists, otherwise + you'll need always a directory for your templates, even your module + won't use templates */ + if ( is_dir($loc . $this->_module . '/' . $this->_config['themes_base_dir'] . $theme) ) + $this->_template_locations[] = $loc . $this->_module . '/' . $this->_config['themes_base_dir'] . $theme; } } }