Files
smarty/libs/plugins/function.eval.php
mohrt f42a23f504 fix config_load, compile fetched arrays to compile_dir, switch display
back to runtime. clean up var names and function names,  split up compile
testing and compiling to separate funcs, rename some template_* functions to
file_* functions and update logic so they can be used for file resources
other than templates.
2003-06-16 19:45:11 +00:00

49 lines
885 B
PHP

<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {eval} function plugin
*
* Type: function<br>
* Name: eval<br>
* Purpose: evaluate a template variable as a template<br>
* @link http://smarty.php.net/manual/en/language.function.eval.php {eval}
* (Smarty online manual)
* @param array
* @param Smarty
*/
function smarty_function_eval($params, &$smarty)
{
extract($params);
if (!isset($var)) {
$smarty->trigger_error("eval: missing 'var' parameter");
return;
}
if($var == '') {
return;
}
$smarty->_compile_template("evaluated template", $var, $source);
ob_start();
eval('?>' . $source);
$contents = ob_get_contents();
ob_end_clean();
if (!empty($assign)) {
$smarty->assign($assign, $contents);
} else {
return $contents;
}
}
/* vim: set expandtab: */
?>