mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
add append feature to capture
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- add append feature to {capture} (jablko, monte)
|
||||||
- fix when (un)registering filters with the same method name but different class
|
- fix when (un)registering filters with the same method name but different class
|
||||||
name (danilo)
|
name (danilo)
|
||||||
- fix calling registered objects' methods with an empty argument list
|
- fix calling registered objects' methods with an empty argument list
|
||||||
|
@@ -1222,23 +1222,21 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
|
|
||||||
if ($start) {
|
if ($start) {
|
||||||
if (isset($attrs['name']))
|
$buffer = isset($attrs['name']) ? $attrs['name'] : "'default'";
|
||||||
$buffer = $attrs['name'];
|
$assign = isset($attrs['assign']) ? $attrs['assign'] : null;
|
||||||
else
|
$append = isset($attrs['append']) ? $attrs['append'] : null;
|
||||||
$buffer = "'default'";
|
|
||||||
|
|
||||||
if (isset($attrs['assign']))
|
|
||||||
$assign = $attrs['assign'];
|
|
||||||
else
|
|
||||||
$assign = null;
|
|
||||||
$output = "<?php ob_start(); ?>";
|
$output = "<?php ob_start(); ?>";
|
||||||
$this->_capture_stack[] = array($buffer, $assign);
|
$this->_capture_stack[] = array($buffer, $assign, $append);
|
||||||
} else {
|
} else {
|
||||||
list($buffer, $assign) = array_pop($this->_capture_stack);
|
list($buffer, $assign, $append) = array_pop($this->_capture_stack);
|
||||||
$output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); ";
|
$output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); ";
|
||||||
if (isset($assign)) {
|
if (isset($assign)) {
|
||||||
$output .= " \$this->assign($assign, ob_get_contents());";
|
$output .= " \$this->assign($assign, ob_get_contents());";
|
||||||
}
|
}
|
||||||
|
if (isset($append)) {
|
||||||
|
$output .= " \$this->append($append, ob_get_contents());";
|
||||||
|
}
|
||||||
$output .= "ob_end_clean(); ?>";
|
$output .= "ob_end_clean(); ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user