Index: branches/RC/core/kernel/nparser/ntags.php =================================================================== diff -u -N -r11678 -r11870 --- branches/RC/core/kernel/nparser/ntags.php (.../ntags.php) (revision 11678) +++ branches/RC/core/kernel/nparser/ntags.php (.../ntags.php) (revision 11870) @@ -419,6 +419,13 @@ */ var $_Inversed = false; + /** + * Count of "elseif" tags inside + * + * @var int + */ + var $_elseIfCount = 0; + function _Tag_If($tag) { parent::_BlockTag($tag); @@ -464,14 +471,18 @@ $to_pass = $this->Parser->CompileParamsArray($tag['NP']); + $this->_elseIfCount++; // add same count of closing brackets in closing tag + + $this->AppendCode($o, "} else {"); + $code[] = "\$_splited = \$_parser->SplitTag(array('tag'=>\"{$tag['NP']['check']}\", 'file'=>'{$tag['file']}', 'line'=>{$tag['line']}));"; $code[] = 'if ($_splited[\'prefix\'] == \'__auto__\') {$_splited[\'prefix\'] = $PrefixSpecial;}'; $code[] = '$_p_ =& $_parser->GetProcessor($_splited[\'prefix\']);'; if (isset($tag['NP']['inverse']) || $this->_Inversed) { - $code[] = "} else if (!\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; + $code[] = "if (!\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; } else { - $code[] = "} else if (\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; + $code[] = "if (\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; } $this->AppendCode($o, $code); @@ -483,7 +494,10 @@ function Close($tag) { $o = $this->Parser->Buffers[$this->Parser->Level]; - $this->AppendCode($o, "}\n"); + + $code = str_repeat("}\n", $this->_elseIfCount + 1); + $this->AppendCode($o, $code); + return $o; } }