cvs: smarty /libs Smarty_Compiler.class.php
| From: | Monte Ohrt | Date: | Sat, 15 Mar 2003 20:03:48 +0000 |
| Subject: | cvs: smarty /libs Smarty_Compiler.class.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-460@lists.php.net to get a copy of this message | ||
mohrt Sat Mar 15 15:03:48 2003 EDT
Modified files:
/smarty/libs Smarty_Compiler.class.php
Log:
fix @ logic, only use upon an echo
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.191 smarty/libs/Smarty_Compiler.class.php:1.192
--- smarty/libs/Smarty_Compiler.class.php:1.191 Sat Mar 15 14:34:46 2003
+++ smarty/libs/Smarty_Compiler.class.php Sat Mar 15 15:03:46 2003
@@ -387,11 +387,15 @@
/* If the tag name is a variable or object, we process it. */
if (preg_match('!^' . $this->_obj_call_regexp . '|' .
$this->_var_regexp . '$!', $tag_command)) {
- $return = $this->_parse_var_props($tag_command . $tag_modifier,
$this->_parse_attrs($tag_args));
+ $_return = $this->_parse_var_props($tag_command . $tag_modifier,
$this->_parse_attrs($tag_args));
if(isset($_tag_attrs['assign'])) {
- return "<?php \$this->assign('" .
$this->_dequote($_tag_attrs['assign']) . "', $return ); ?>\n";
+ return "<?php \$this->assign('" .
$this->_dequote($_tag_attrs['assign']) . "', $_return ); ?>\n";
} else {
- return "<?php echo $return; ?>\n";
+ // prepend '@' if eching a variable
+ if(substr($_return, 0, 1) == '$') {
+ $_return = '@' . $_return;
+ }
+ return "<?php echo $_return; ?>\n";
}
}
@@ -1498,10 +1502,10 @@
$output = $smarty_ref;
} else {
$var_name = substr(array_shift($indexes), 1);
- $output = "@\$this->_smarty_vars['$var_name']";
+ $output = "\$this->_smarty_vars['$var_name']";
}
} else {
- $output = "@\$this->_tpl_vars['$var_name']";
+ $output = "\$this->_tpl_vars['$var_name']";
}
foreach ($indexes as $index) {
@@ -1510,16 +1514,16 @@
if (is_numeric($index)) {
$output .= "[$index]";
} elseif ($index{0} == '$') {
- $output .= "[@\$this->_tpl_vars['" . substr($index, 1) .
"']]";
+ $output .= "[\$this->_tpl_vars['" . substr($index, 1) .
"']]";
} else {
$parts = explode('.', $index);
$section = $parts[0];
$section_prop = isset($parts[1]) ? $parts[1] : 'index';
- $output .=
"[@\$this->_sections['$section']['$section_prop']]";
+ $output .=
"[\$this->_sections['$section']['$section_prop']]";
}
} else if ($index{0} == '.') {
if ($index{1} == '$')
- $output .= "[@\$this->_tpl_vars['" . substr($index, 2) .
"']]";
+ $output .= "[\$this->_tpl_vars['" . substr($index, 2) .
"']]";
else
$output .= "['" . substr($index, 1) . "']";
} else if (substr($index,0,2) == '->') {