mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-10 05:14:26 +02:00
- removed block nesting checks for {capture}
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
10/07/2009
|
||||||
|
- removed block nesting checks for {capture}
|
||||||
|
|
||||||
10/05/2009
|
10/05/2009
|
||||||
- added support of "isinstance" to {if} tag
|
- added support of "isinstance" to {if} tag
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
* Smarty Internal Plugin Compile Capture
|
* Smarty Internal Plugin Compile Capture
|
||||||
*
|
*
|
||||||
* Compiles the {capture} tag
|
* Compiles the {capture} tag
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Compiler
|
* @subpackage Compiler
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
@@ -21,21 +22,15 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
|
|||||||
public function compile($args, $compiler)
|
public function compile($args, $compiler)
|
||||||
{
|
{
|
||||||
$this->compiler = $compiler;
|
$this->compiler = $compiler;
|
||||||
$this->optional_attributes = array('name', 'assign');
|
$this->optional_attributes = array('name', 'assign', 'append');
|
||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->_get_attributes($args);
|
$_attr = $this->_get_attributes($args);
|
||||||
|
|
||||||
if (isset($_attr['name']))
|
$buffer = isset($_attr['name']) ? $_attr['name'] : "'default'";
|
||||||
$buffer = $_attr['name'];
|
$assign = isset($_attr['assign']) ? $_attr['assign'] : null;
|
||||||
else
|
$append = isset($_attr['append']) ? $_attr['append'] : null;
|
||||||
$buffer = "'default'";
|
|
||||||
|
|
||||||
if (isset($_attr['assign']))
|
$this->compiler->_capture_stack[] = array($buffer, $assign, $append);
|
||||||
$assign = $_attr['assign'];
|
|
||||||
else
|
|
||||||
$assign = null;
|
|
||||||
|
|
||||||
$this->_open_tag('capture',array($buffer, $assign));
|
|
||||||
|
|
||||||
$_output = "<?php ob_start(); ?>";
|
$_output = "<?php ob_start(); ?>";
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
* Smarty Internal Plugin Compile Capture Close
|
* Smarty Internal Plugin Compile Capture Close
|
||||||
*
|
*
|
||||||
* Compiles the {/capture} tag
|
* Compiles the {/capture} tag
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Compiler
|
* @subpackage Compiler
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
@@ -24,13 +25,16 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
|||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->_get_attributes($args);
|
$_attr = $this->_get_attributes($args);
|
||||||
|
|
||||||
$saved_attr = $this->_close_tag(array('capture'));
|
list($buffer, $assign, $append) = array_pop($this->compiler->_capture_stack);
|
||||||
|
|
||||||
$_output = "<?php ";
|
$_output = "<?php ";
|
||||||
if (isset($saved_attr[1])) {
|
if (isset($assign)) {
|
||||||
$_output .= " \$_smarty_tpl->assign($saved_attr[1], ob_get_contents());";
|
$_output .= " \$_smarty_tpl->assign($assign, ob_get_contents());";
|
||||||
}
|
}
|
||||||
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$saved_attr[0]]=ob_get_clean(); ?>\n";
|
if (isset($append)) {
|
||||||
|
$_output .= " \$_smarty_tpl->append($append, ob_get_contents());";
|
||||||
|
}
|
||||||
|
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean(); ?>\n";
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user