Index: branches/5.0.x/core/kernel/nparser/nparser.php =================================================================== diff -u -N -r12495 -r12704 --- branches/5.0.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12495) +++ branches/5.0.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12704) @@ -1,6 +1,6 @@ CompileParamsArray($tag['NP']); - $code = ''; + $to_pass = $this->CompileParamsArray($tag['NP']); + if ($tag['prefix'] == '__auto__') { $prefix = $this->GetParam('PrefixSpecial'); $code .= '$_p_ =& $_parser->GetProcessor($PrefixSpecial);'."\n"; @@ -304,17 +311,20 @@ $code .= '$_p_ =& $_parser->GetProcessor("'.$tag['prefix'].'");'."\n"; $code .= 'echo $_p_->ProcessParsedTag(\''.$tag['name'].'\', '.$to_pass.', "'.$tag['prefix'].'", \''.$tag['file'].'\', '.$tag['line'].');'."\n"; } - if (isset($tag['NP']['result_to_var'])) { + + if (array_key_exists('result_to_var', $tag['NP']) && $tag['NP']['result_to_var']) { $code .= "\$params['{$tag['NP']['result_to_var']}'] = \$_parser->GetParam('{$tag['NP']['result_to_var']}');\n"; $code .= "\${$tag['NP']['result_to_var']} = \$params['{$tag['NP']['result_to_var']}'];\n"; } + if ($prefix && strpos($prefix, '$') === false) { $p =& $this->GetProcessor($prefix); if (!is_object($p) || !$p->CheckTag($tag['name'], $tag['prefix'])) { $this->Application->handleError(E_USER_ERROR, 'Unknown tag: '.$this->TagInfo($tag).' - incorrect tag name or prefix ', $tag['file'], $tag['line']); return false; } } + return $code; } @@ -490,6 +500,13 @@ $block_params = $this->Params; // input parameters, but modified inside rendered block $this->PopParams(); + if (array_key_exists('result_to_var', $flag_values) && $flag_values['result_to_var']) { + // when "result_to_var" used inside ParseBlock, then $$result_to_var parameter is set inside ParseBlock, + // but not outside it as expected and got lost at all after PopParams is called, so make it work by + // setting it's value on current parameter deep level (from where ParseBlock was called) + $this->SetParam($flag_values['result_to_var'], $block_params[ $flag_values['result_to_var'] ]); + } + $this->CheckNoData($ret, $params); $this->DataExists = $data_exists_bak || $this->DataExists; Index: branches/5.0.x/core/kernel/nparser/ntags.php =================================================================== diff -u -N -r12299 -r12704 --- branches/5.0.x/core/kernel/nparser/ntags.php (.../ntags.php) (revision 12299) +++ branches/5.0.x/core/kernel/nparser/ntags.php (.../ntags.php) (revision 12704) @@ -1,6 +1,6 @@ PostProcess(\${$tag['NP']['name']}, \$_p_->PreparePostProcess(\$_tag_params));"; $code[] = "}"; - - if (array_key_exists('plus', $tag['NP'])) { + + if (array_key_exists('result_to_var', $tag['NP']) && $tag['NP']['result_to_var']) { + $code[] = "\$params['{$tag['NP']['result_to_var']}'] = \$_parser->GetParam('{$tag['NP']['result_to_var']}');"; + + if (array_key_exists('plus', $tag['NP'])) { + $code[] = "\$params['{$tag['NP']['result_to_var']}'] += {$tag['NP']['plus']};"; + } + + $code[] = "\${$tag['NP']['result_to_var']} = \$params['{$tag['NP']['result_to_var']}'];"; + } + elseif (array_key_exists('plus', $tag['NP'])) { $code[] = "\${$tag['NP']['name']} += {$tag['NP']['plus']};"; } Index: branches/5.0.x/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r12666 -r12704 --- branches/5.0.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 12666) +++ branches/5.0.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 12704) @@ -1,6 +1,6 @@ Application->LateParsed[$name])) { - $f = $this->Application->PreParsedBlocks['capture_'.$name.$this->Application->LateParsed[$name]]; - $this->Application->Parser->SetParam($name, $f(array())); - }*/ - - $res = $this->Application->Parser->GetParam($params['name']); + if (array_key_exists($name, $this->Application->Parser->Captures)) { + $capture_params = $params; + $capture_params['name'] = '__capture_' . $name; + + $this->Application->Parser->SetParam($name, $this->Application->ParseBlock($capture_params)); + } + + $res = $this->Application->Parser->GetParam($name); + if ($res === false) { $res = ''; } - if (isset($params['plus'])) { + if (array_key_exists('plus', $params)) { $res += $params['plus']; }