cvs: smarty / NEWS /libs Smarty_Compiler.class.php
| From: | Messju Mohr | Date: | Thu, 19 Jun 2003 10:42:59 +0000 |
| Subject: | cvs: smarty / NEWS /libs Smarty_Compiler.class.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-666@lists.php.net to get a copy of this message | ||
messju Thu Jun 19 06:42:59 2003 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty_Compiler.class.php
Log:
added optional assign-attribute to {capture}-tag
Index: smarty/NEWS
diff -u smarty/NEWS:1.382 smarty/NEWS:1.383
--- smarty/NEWS:1.382 Thu Jun 19 06:35:23 2003
+++ smarty/NEWS Thu Jun 19 06:42:59 2003
@@ -1,3 +1,4 @@
+ - added optional assign-attribute to {capture}-tag (messju)
- added $cacheable-parameter to register_compiler_function() (messju)
- added $cacheable-parameter with default=true to register_function()
and register_block() (messju)
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.245 smarty/libs/Smarty_Compiler.class.php:1.246
--- smarty/libs/Smarty_Compiler.class.php:1.245 Wed Jun 18 19:01:41 2003
+++ smarty/libs/Smarty_Compiler.class.php Thu Jun 19 06:42:59 2003
@@ -39,7 +39,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.245 2003/06/18 23:01:41 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.246 2003/06/19 10:42:59 messju Exp $ */
/**
* Template compiling class
* @package Smarty
@@ -1110,11 +1110,19 @@
else
$buffer = "'default'";
+ if (isset($attrs['assign']))
+ $assign = $attrs['assign'];
+ else
+ $assign = null;
$output = "<?php ob_start(); ?>";
- $this->_capture_stack[] = $buffer;
+ $this->_capture_stack[] = array($buffer, $assign);
} else {
- $buffer = array_pop($this->_capture_stack);
- $output = "<?php \$this->_smarty_vars['capture'][$buffer] =
ob_get_contents(); ob_end_clean(); ?>";
+ list($buffer, $assign) = array_pop($this->_capture_stack);
+ $output = "<?php \$this->_smarty_vars['capture'][$buffer] =
ob_get_contents(); ";
+ if (isset($assign)) {
+ $output .= " \$this->assign($assign, ob_get_contents());";
+ }
+ $output .= "ob_end_clean(); ?>";
}
return $output;