{"issue":{"created_at":"2011-11-29T04:23:52Z","state":"open","updated_at":"2011-11-29T04:23:52Z","comments":0,"user":{"gravatar_id":"256406243346b9253f8610fb1d1e05f6","id":1215373,"url":"https://api.github.com/users/importer","avatar_url":"https://secure.gravatar.com/avatar/256406243346b9253f8610fb1d1e05f6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"importer"},"body":"for convenience i organized the /templates folder at the root of TL for having subfolders relative to modules name:\n\n/templates\n/templates/frontend\n/templates/newsletter\n/templates/another_module_name..\n\nhere is how i modified the 2 functions in /system/libraries/Controller.php :\n\n```\n\tprotected function getTemplate($strTemplate)\n\t{\n\t\t$strFile = sprintf('%s/templates/%s.tpl', TL_ROOT, $strTemplate);\n\n\t\tif (\n\n![](file_exists($strFile))\n\t\t{\n\t\t\tforeach ($this->Config->getActiveModules() as $strModule)\n\t\t\t{\n\t\t\t\t$strPath = sprintf('%s/templates/%s/%s.tpl', TL_ROOT, $strModule, $strTemplate);\n\t\t\t\tif (file_exists($strPath)) {\n\t\t\t\t\t$strFile = $strPath;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$strPath = sprintf('%s/system/modules/%s/templates/%s.tpl', TL_ROOT, $strModule, $strTemplate);\n\t\t\t\tif (file_exists($strPath)) {\n\t\t\t\t\t$strFile = $strPath;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ()file_exists($strFile))\n\t\t{\n\t\t\tthrow new Exception(sprintf('Could not find template file \"%s\"', $strTemplate));\n\t\t}\n\n\t\treturn $strFile;\n\t}\n```\n\nand\n\n```\n\tprotected function getTemplateGroup($strPrefix)\n\t{\n\t\t$arrTemplates = array();\n\t\t$arrFolders = array(TL_ROOT . '/templates');\n\n\t\tforeach ($this->Config->getActiveModules() as $strModule)\n\t\t{\n\t\t\t$strFolder = sprintf('%s/templates/%s', TL_ROOT, $strModule);\n\t\t\tif (is_dir($strFolder)) {\n\t\t\t\t$arrFolders[] = $strFolder;\n\t\t\t}\n\t\t\t\n\t\t\t$strFolder = sprintf('%s/system/modules/%s/templates', TL_ROOT, $strModule);\n\t\t\tif (is_dir($strFolder)) {\n\t\t\t\t$arrFolders[] = $strFolder;\n\t\t\t}\n\t\t}\n\n\t\tforeach ($arrFolders as $strFolder)\n\t\t{\n\t\t\t$arrFiles = preg_grep('/^' . preg_quote($strPrefix, '/') . '.*\\.tpl$/i',  scan($strFolder));\n\n\t\t\tforeach ($arrFiles as $strTemplate)\n\t\t\t{\n\t\t\t\t$arrTemplates[] = basename($strTemplate, '.tpl');\n\t\t\t}\n\t\t}\n\n\t\treturn array_values(array_unique($arrTemplates));\n\t}\n```\n\nthat way it's still checking inside the root of /templates (i put there only fe_ templates) before checking /templates/module\n\n\nit works for me and if you think it could be relevant enough, this could be a feature request\n\nRelated issues: #1348\n\n--- _Originally created by anonymous on September 2nd, 2008, at 12:20pm (ID 46)_","assignee":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leofeyer"},"id":2377071,"number":46,"labels":[{"name":"Feature","color":"4183c4","url":"https://api.github.com/repos/contao/test/labels/Feature"},{"name":"framework","color":"e6e6e6","url":"https://api.github.com/repos/contao/test/labels/framework"}],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Organising templates in /templates folder","closed_at":null,"html_url":"https://github.com/contao/test/issues/46","url":"https://api.github.com/repos/contao/test/issues/46","milestone":null},"action":"opened"}