cvs: smarty / NEWS Smarty.class.php
| From: | Monte Ohrt | Date: | Fri, 02 Aug 2002 18:17:41 +0000 |
| Subject: | cvs: smarty / NEWS Smarty.class.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-222@lists.php.net to get a copy of this message | ||
mohrt Fri Aug 2 14:17:41 2002 EDT
Modified files:
/smarty NEWS Smarty.class.php
Log:
added assign_by_ref() and append_by_ref() functions
Index: smarty/NEWS
diff -u smarty/NEWS:1.225 smarty/NEWS:1.226
--- smarty/NEWS:1.225 Thu Aug 1 17:04:37 2002
+++ smarty/NEWS Fri Aug 2 14:17:40 2002
@@ -1,3 +1,5 @@
+ - added assign_by_ref() and append_by_ref() functions
+ (Monte)
- changed default warning type for plugin errors from
E_USER_WARNING to E_USER_ERROR (Monte)
- added $all_extra, $hour_extra, $minute_extra,
Index: smarty/Smarty.class.php
diff -u smarty/Smarty.class.php:1.309 smarty/Smarty.class.php:1.310
--- smarty/Smarty.class.php:1.309 Thu Aug 1 17:04:37 2002
+++ smarty/Smarty.class.php Fri Aug 2 14:17:40 2002
@@ -240,17 +240,27 @@
$this->_extract = true;
}
-
+/*======================================================================*\
+ Function: assign_by_ref()
+ Purpose: assigns values to template variables by reference
+\*======================================================================*/
+ function assign_by_ref($tpl_var, &$value)
+ {
+ if ($tpl_var != '' && isset($value))
+ $this->_tpl_vars[$tpl_var] = &$value;
+ $this->_extract = true;
+ }
+
/*======================================================================*\
Function: append
- Purpose: appens values to template variables
+ Purpose: appends values to template variables
\*======================================================================*/
function append($tpl_var, $value = NULL)
{
if (is_array($tpl_var)) {
foreach ($tpl_var as $key => $val) {
if ($key != '') {
- if(!is_array($this->_tpl_vars[$key])) {
+ if(!@is_array($this->_tpl_vars[$key])) {
settype($this->_tpl_vars[$key],'array');
}
$this->_tpl_vars[$key][] = $val;
@@ -258,11 +268,26 @@
}
} else {
if ($tpl_var != '' && isset($value)) {
- if(!is_array($this->_tpl_vars[$tpl_var])) {
+ if(!@is_array($this->_tpl_vars[$tpl_var])) {
settype($this->_tpl_vars[$tpl_var],'array');
}
$this->_tpl_vars[$tpl_var][] = $value;
}
+ }
+ $this->_extract = true;
+ }
+
+/*======================================================================*\
+ Function: append_by_ref
+ Purpose: appends values to template variables by reference
+\*======================================================================*/
+ function append_by_ref($tpl_var, &$value)
+ {
+ if ($tpl_var != '' && isset($value)) {
+ if(!@is_array($this->_tpl_vars[$tpl_var])) {
+ settype($this->_tpl_vars[$tpl_var],'array');
+ }
+ $this->_tpl_vars[$tpl_var][] = &$value;
}
$this->_extract = true;
}