*** empty log message ***

This commit is contained in:
andrey
2002-02-27 22:35:34 +00:00
parent e3556e0c0b
commit 8a24a176d2
4 changed files with 18 additions and 16 deletions

3
NEWS
View File

@@ -1,6 +1,7 @@
Version 2.0 Version 2.0
----------- -----------
- added "eval" plugin for evaluating variables as templates (Monte) - added "eval" function plugin for evaluating variables as templates.
(Monte)
- removed $tpl_file_ext class variable, no longer used. (Monte) - removed $tpl_file_ext class variable, no longer used. (Monte)
- added "hex" and "hexentity" escape types to escape modifier. (Monte) - added "hex" and "hexentity" escape types to escape modifier. (Monte)
- removed dependency on PEAR. (Andrei) - removed dependency on PEAR. (Andrei)

View File

@@ -2712,13 +2712,6 @@ The value of $name is Bob.</programlisting>
counter function will be assigned to this template variable instead of counter function will be assigned to this template variable instead of
being output to the template. (new in Smarty 1.5.0) being output to the template. (new in Smarty 1.5.0)
</para> </para>
<note>
<para>
evaluated variables follow the same rules as templates, so for
instance PHP tags are escaped by default, or if you have
security enabled then embedding PHP is not allowed.
</para>
</note>
<example> <example>
<title>counter</title> <title>counter</title>
<programlisting> <programlisting>
@@ -2764,6 +2757,14 @@ OUTPUT:
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>variable (or string) to evaluate</entry> <entry>variable (or string) to evaluate</entry>
</row> </row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned
to</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>

View File

@@ -17,15 +17,15 @@ function smarty_function_eval($params, &$this)
return; return;
} }
$this->_compile_template("eval_var",$var,$source); $this->_compile_template("evaluated template", $var, $source);
if (!empty($assign)) { if (!empty($assign)) {
ob_start(); ob_start();
eval('?>'.$source); eval('?>' . $source);
$this->assign($assign,ob_get_contents()); $this->assign($assign, ob_get_contents());
ob_end_clean(); ob_end_clean();
} else { } else {
eval('?>'.$source); eval('?>' . $source);
} }
} }

View File

@@ -17,15 +17,15 @@ function smarty_function_eval($params, &$this)
return; return;
} }
$this->_compile_template("eval_var",$var,$source); $this->_compile_template("evaluated template", $var, $source);
if (!empty($assign)) { if (!empty($assign)) {
ob_start(); ob_start();
eval('?>'.$source); eval('?>' . $source);
$this->assign($assign,ob_get_contents()); $this->assign($assign, ob_get_contents());
ob_end_clean(); ob_end_clean();
} else { } else {
eval('?>'.$source); eval('?>' . $source);
} }
} }