Allow themes to have Includes in there templates

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39035 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-07-19 23:34:42 +00:00
parent 97ff1db6f9
commit aa5d463b8b
1 changed files with 9 additions and 2 deletions

View File

@ -117,8 +117,15 @@ class SSViewer extends Object {
public static function getTemplateFile($identifier) {
global $_TEMPLATE_MANIFEST;
if(isset($_TEMPLATE_MANIFEST[$identifier]['Includes'])) return $_TEMPLATE_MANIFEST[$identifier]['Includes'];
else return isset($_TEMPLATE_MANIFEST[$identifier]['main']) ? $_TEMPLATE_MANIFEST[$identifier]['main'] : null;
if(self::$current_theme && isset($_TEMPLATE_MANIFEST[$identifier]['themes'][self::$current_theme]['Includes'])) {
return $_TEMPLATE_MANIFEST[$identifier]['themes'][self::$current_theme]['Includes'];
} else if(isset($_TEMPLATE_MANIFEST[$identifier]['Includes'])){
return $_TEMPLATE_MANIFEST[$identifier]['Includes'];
} else if(self::$current_theme && isset($_TEMPLATE_MANIFEST[$identifier]['themes'][self::$current_theme]['main'])) {
return $_TEMPLATE_MANIFEST[$identifier]['themes'][self::$current_theme]['main'];
} else {
return isset($_TEMPLATE_MANIFEST[$identifier]['main']) ? $_TEMPLATE_MANIFEST[$identifier]['main'] : null;
}
}
public static function getTemplateContent($identifier) {
return file_get_contents(SSViewer::getTemplateFile($identifier));