10 * Smarty {eval} function plugin
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)
20 function smarty_function_eval($params, &$smarty)
23 if (!isset($params['var'])) {
24 $smarty->trigger_error("eval: missing 'var' parameter");
28 if($params['var'] == '') {
32 $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
35 $smarty->_eval('?>' . $_var_compiled);
36 $_contents = ob_get_contents();
39 if (!empty($params['assign'])) {
40 $smarty->assign($params['assign'], $_contents);
46 /* vim: set expandtab: */