From 03741bee6f453b73a0ecccb213d891263da52fcb Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sun, 7 Jul 2013 09:44:33 +0300 Subject: [PATCH] app level templates --- ipf/template/environment.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ipf/template/environment.php b/ipf/template/environment.php index 7d3d79a..0ea8b8e 100644 --- a/ipf/template/environment.php +++ b/ipf/template/environment.php @@ -10,8 +10,21 @@ abstract class IPF_Template_Environment public static function getDefault() { - if (!self::$defaultEnvironment) - self::$defaultEnvironment = new IPF_Template_Environment_FileSystem(IPF::get('template_dirs'), IPF::get('tmp')); + if (!self::$defaultEnvironment) { + $dirs = array(); + + $projectTemplates = IPF::get('project_path') . '/templates'; + if (is_dir($projectTemplates)) + $dirs[] = $projectTemplates; + + foreach (IPF_Project::getInstance()->appList() as $app) { + $applicationTemplates = $app->getPath() . 'templates'; + if (is_dir($applicationTemplates)) + $dirs[] = $applicationTemplates; + } + + self::$defaultEnvironment = new IPF_Template_Environment_FileSystem($dirs, IPF::get('tmp')); + } return self::$defaultEnvironment; } } -- 2.49.0