Updated to Smarty 2.6.26 (June 18th, 2009), we should update to Smarty 3.x (current...
[mirrors/Kyberia-bloodline.git] / wwwroot / smarty / libs / plugins / function.eval.php
CommitLineData
51ff3226 1<?php
2/**
3 * Smarty plugin
4 * @package Smarty
5 * @subpackage plugins
6 */
7
8
9/**
10 * Smarty {eval} function plugin
11 *
12 * Type: function<br>
13 * Name: eval<br>
14 * Purpose: evaluate a template variable as a template<br>
15 * @link http://smarty.php.net/manual/en/language.function.eval.php {eval}
16 * (Smarty online manual)
9b7c11be 17 * @author Monte Ohrt <monte at ohrt dot com>
51ff3226 18 * @param array
19 * @param Smarty
20 */
21function smarty_function_eval($params, &$smarty)
22{
23
24 if (!isset($params['var'])) {
25 $smarty->trigger_error("eval: missing 'var' parameter");
26 return;
27 }
28
29 if($params['var'] == '') {
30 return;
31 }
32
33 $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
34
35 ob_start();
36 $smarty->_eval('?>' . $_var_compiled);
37 $_contents = ob_get_contents();
38 ob_end_clean();
39
40 if (!empty($params['assign'])) {
41 $smarty->assign($params['assign'], $_contents);
42 } else {
43 return $_contents;
44 }
45}
46
47/* vim: set expandtab: */
48
49?>
This page took 0.239244 seconds and 4 git commands to generate.