| 1 |
cvsjoko |
1.1 |
<?php |
| 2 |
|
|
|
| 3 |
|
|
/* |
| 4 |
|
|
* Smarty plugin |
| 5 |
|
|
* ------------------------------------------------------------- |
| 6 |
|
|
* Type: function |
| 7 |
|
|
* Name: eval |
| 8 |
|
|
* Purpose: evaluate a template variable as a template |
| 9 |
|
|
* ------------------------------------------------------------- |
| 10 |
|
|
*/ |
| 11 |
|
|
function smarty_function_eval($params, &$this) |
| 12 |
|
|
{ |
| 13 |
|
|
extract($params); |
| 14 |
|
|
|
| 15 |
|
|
if (!isset($var)) { |
| 16 |
|
|
$this->trigger_error("eval: missing 'var' parameter"); |
| 17 |
|
|
return; |
| 18 |
|
|
} |
| 19 |
|
|
if($var == '') { |
| 20 |
|
|
return; |
| 21 |
|
|
} |
| 22 |
|
|
|
| 23 |
|
|
$this->_compile_template("evaluated template", $var, $source); |
| 24 |
|
|
|
| 25 |
|
|
if (!empty($assign)) { |
| 26 |
|
|
ob_start(); |
| 27 |
|
|
eval('?>' . $source); |
| 28 |
|
|
$this->assign($assign, ob_get_contents()); |
| 29 |
|
|
ob_end_clean(); |
| 30 |
|
|
} else { |
| 31 |
|
|
eval('?>' . $source); |
| 32 |
|
|
} |
| 33 |
|
|
} |
| 34 |
|
|
|
| 35 |
|
|
/* vim: set expandtab: */ |
| 36 |
|
|
|
| 37 |
|
|
?> |