diff --git a/common/framework/parsers/template/TemplateParser_v2.php b/common/framework/parsers/template/TemplateParser_v2.php index c6ab63165..c09742fb3 100644 --- a/common/framework/parsers/template/TemplateParser_v2.php +++ b/common/framework/parsers/template/TemplateParser_v2.php @@ -307,7 +307,7 @@ class TemplateParser_v2 protected function _convertIncludes(string $content): string { // Convert XE-style include directives. - $regexp = '#^[\x09\x20]*()[\x09\x20]*$#m'; + $regexp = '#^[\x09\x20]*()[\x09\x20]*$#m'; $content = preg_replace_callback($regexp, function($match) { $attrs = self::_getTagAttributes($match[1]); $path = $attrs['src'] ?? ($attrs['target'] ?? null); @@ -315,13 +315,15 @@ class TemplateParser_v2 $tpl = 'relative_dirname, "' . $path . '", "' . ($this->template->extension ?: 'auto') . '"); '; $tpl .= !empty($attrs['vars']) ? ' $__tpl->setVars(' . $attrs['vars'] . '); ' : ''; $tpl .= 'echo $__tpl->compile(); ?>'; - if (!empty($attrs['if']) || !empty($attrs['when'])) + if (!empty($attrs['if']) || !empty($attrs['when']) || !empty($attrs['cond'])) { - $tpl = '' . $tpl . ''; + $condition = $attrs['if'] ?? ($attrs['when'] ?? $attrs['cond']); + $tpl = '' . $tpl . ''; } if (!empty($attrs['unless'])) { - $tpl = '' . $tpl . ''; + $condition = $attrs['unless']; + $tpl = '' . $tpl . ''; } return self::_escapeVars($tpl); }, $content);