From d4c07930d51244c8ae5014344c9502d010954448 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Fri, 10 May 2013 06:13:24 -0400 Subject: add $db_port to .htconfig.php and $a->config['syste]['smarty3_folder'] for compiled templates --- include/friendica_smarty.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'include/friendica_smarty.php') diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php index a4675acd4..ec0748600 100755 --- a/include/friendica_smarty.php +++ b/include/friendica_smarty.php @@ -21,9 +21,11 @@ class FriendicaSmarty extends Smarty { $template_dirs = $template_dirs + array('base' => 'view/tpl/'); $this->setTemplateDir($template_dirs); - $this->setCompileDir('view/tpl/smarty3/compiled/'); - $this->setConfigDir('view/tpl/smarty3/config/'); - $this->setCacheDir('view/tpl/smarty3/cache/'); + $basecompiledir = $a->config['system']['smarty3_folder']; + + $this->setCompileDir($basecompiledir.'/compiled/'); + $this->setConfigDir($basecompiledir.'/config/'); + $this->setCacheDir($basecompiledir.'/cache/'); $this->left_delimiter = $a->get_template_ldelim('smarty3'); $this->right_delimiter = $a->get_template_rdelim('smarty3'); @@ -46,9 +48,16 @@ class FriendicaSmartyEngine implements ITemplateEngine { static $name ="smarty3"; public function __construct(){ - if(!is_writable('view/tpl/smarty3/')){ - echo "ERROR: folder view/tpl/smarty3/ must be writable by webserver."; killme(); + $a = get_app(); + $basecompiledir = $a->config['system']['smarty3_folder']; + if (!$basecompiledir) $basecompiledir = dirname(__dir__)."/view/tpl/smarty3"; + if (!is_dir($basecompiledir)) { + echo "ERROR: folder $basecompiledirdoes not exixst."; killme(); + } + if(!is_writable($basecompiledir)){ + echo "ERROR: folder $basecompiledir must be writable by webserver."; killme(); } + $a->config['system']['smarty3_folder'] = $basecompiledir; } // ITemplateEngine interface -- cgit v1.2.3