{"issue":{"created_at":"2011-11-28T17:24:41Z","state":"open","updated_at":"2011-11-28T17:24:43Z","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"},"comments":2,"body":"Hi Leo,\n\nCurrently to manage multiple sites in typolight it's not possible to specify different templates, but just a different css for each page layout.\nI suggest to adding a drop down field in the \"Page Layout\" menu, with a list of themes (similar to how the backend works already, but also for .tpl files), so that you can define .tpl files specific to each individual site (eg for menage multiple sites with many layout difference).\n\nThe structure would be:\n\n/templates\n/templates/theme1\n/templates/theme2\n\nThis could be done by modifying the function getTemplate($strTemplate) in the file Controller.php for seeking if $strTemplate \nis present in the selected theme directory (eg: /templates/$frontendTheme) before seeking in /templates\n\nThe function could become (/system/libraries/Controller.php):\n\n```\n\t/**\n\t * Find a particular template file and return its path\n\t * `param string\n\t * `return string\n\t * @throws Exception\n\t */\n\tprotected function getTemplate($strTemplate)\n\t{\n\t\t//NEW: find template in current frontend theme\n\t\tif( $GLOBALS['frontendTheme'] \n\n![](= null ){\n\t\t\t$strFile = sprintf('%s/themes/%s/templates/%s.tpl', TL_ROOT, $GLOBALS['frontendTheme'], $strTemplate);\n\t\t\t\n\t\t\tif (file_exists($strFile)){\n\t\t\t\treturn $strFile;\n\t\t\t}\n\t\t}\n\t\t////NEW: end - find template in current frontend theme\n\t\t\n\t\t$strFile = sprintf('%s/templates/%s.tpl', TL_ROOT, $strTemplate);\n\n\t\tif ()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/system/modules/%s/templates/%s.tpl', TL_ROOT, $strModule, $strTemplate);\n\n\t\t\t\tif (file_exists($strPath))\n\t\t\t\t{\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\nIn attachment, a screenshot of backend Page layout new field.\n\n[Download the attachments](http://www.contao.org/tl_files/tickets/772.zip \"Download the attachments of this ticket\")\n\n--- _Originally created by dennisforrest on June 4th, 2009, at 12:46pm (ID 772)_","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":2370527,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":772,"labels":[{"name":"Feature","color":"4183c4","url":"https://api.github.com/repos/contao/test/labels/Feature"},{"name":"frontend","color":"e6e6e6","url":"https://api.github.com/repos/contao/test/labels/frontend"}],"title":"Multiple frontend template specifiable by layout","closed_at":null,"html_url":"https://github.com/contao/test/issues/772","url":"https://api.github.com/repos/contao/test/issues/772","milestone":null},"action":"created","comment":{"created_at":"2011-11-28T17:24:43Z","updated_at":"2011-11-28T17:24:43Z","user":{"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"},"body":"--- _Originally closed on June 4th, 2009, at 01:34pm_","id":2902710,"url":"https://api.github.com/repos/contao/test/issues/comments/2902710"}}