Fix root not added to internationalized template search

This commit is contained in:
M.Dent 2018-08-12 19:02:11 -04:00
parent 759a18685b
commit 9402f537b6

View File

@ -64,17 +64,20 @@ class SmartyTemplate implements TemplateEngine {
public function get_intltext_template($file, $root='') {
$lang = \App::$language;
if(file_exists("view/$lang/$file"))
$template_file = "view/$lang/$file";
elseif(file_exists("view/en/$file"))
$template_file = "view/en/$file";
else
$template_file = theme_include($file,$root);
if ($root != '' && substr($root,-1) != '/' ) {
$root .= '/';
}
foreach (Array(
$root."view/$lang/$file",
$root."view/en/$file",
''
) as $template_file) {
if (is_file($template_file)) { break; }
}
if ($template_file=='') {$template_file = theme_include($file,$root);}
if($template_file) {
$template = new SmartyInterface();
$template->filename = $template_file;
return $template;
}
return "";