Skip to content

Commit

Permalink
- bugfix {capture} data could not been seen in other templates with {…
Browse files Browse the repository at this point in the history
…$smarty.capture.name} #153
  • Loading branch information
uwetews committed Jan 27, 2016
1 parent f59b00c commit 4168481
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- bugfix output filters did not observe nocache code flhttps://github.com/smarty-php/smarty/issues/154g https://github.com/smarty-php/smarty/issues/160
- bugfix {extends} with relative file path did not work https://github.com/smarty-php/smarty/issues/154
https://github.com/smarty-php/smarty/issues/158
- bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153

26.01.2016
- improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169
Expand Down
2 changes: 1 addition & 1 deletion libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.30-dev/24';
const SMARTY_VERSION = '3.1.30-dev/25';

/**
* define variable scopes
Expand Down
8 changes: 4 additions & 4 deletions libs/sysplugins/smarty_internal_compile_capture.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
$compiler->_capture_stack[0][] = array($buffer, $assign, $append, $compiler->nocache);
// maybe nocache because of nocache variables
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
$_output = "<?php \$_smarty_tpl->_cache['capture_stack'][] = array($buffer, $assign, $append); ob_start(); ?>";
$_output = "<?php \$_smarty_tpl->smarty->_cache['capture_stack'][] = array($buffer, $assign, $append); ob_start(); ?>";

return $_output;
}
Expand All @@ -74,7 +74,7 @@ public static function compileSpecialVariable($args, Smarty_Internal_TemplateCom
if (!$name) {
$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
}
return "(isset(\$_smarty_tpl->_cache['__smarty_capture']['{$name}']) ? \$_smarty_tpl->_cache['__smarty_capture']['{$name}'] : null)";
return "(isset(\$_smarty_tpl->smarty->_cache['__smarty_capture']['{$name}']) ? \$_smarty_tpl->smarty->_cache['__smarty_capture']['{$name}'] : null)";
}
}

Expand Down Expand Up @@ -105,11 +105,11 @@ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)

list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack[0]);

$_output = "<?php list(\$_capture_buffer, \$_capture_assign, \$_capture_append) = array_pop(\$_smarty_tpl->_cache['capture_stack']);\n";
$_output = "<?php list(\$_capture_buffer, \$_capture_assign, \$_capture_append) = array_pop(\$_smarty_tpl->smarty->_cache['capture_stack']);\n";
$_output .= "if (!empty(\$_capture_buffer)) {\n";
$_output .= " if (isset(\$_capture_assign)) \$_smarty_tpl->assign(\$_capture_assign, ob_get_contents());\n";
$_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n";
$_output .= "\$_smarty_tpl->_cache['__smarty_capture'][\$_capture_buffer]=ob_get_clean();\n";
$_output .= "\$_smarty_tpl->smarty->_cache['__smarty_capture'][\$_capture_buffer]=ob_get_clean();\n";
$_output .= "} else \$_smarty_tpl->capture_error();?>";

return $_output;
Expand Down

0 comments on commit 4168481

Please sign in to comment.