/[cvs]/nfo/php/libs/net.php.smarty/plugins/function.eval.php
ViewVC logotype

Contents of /nfo/php/libs/net.php.smarty/plugins/function.eval.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Jun 16 21:58:16 2004 UTC (20 years ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +34 -23 lines
updated to smarty-2.6.3

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)
17 * @param array
18 * @param Smarty
19 */
20 function smarty_function_eval($params, &$smarty)
21 {
22
23 if (!isset($params['var'])) {
24 $smarty->trigger_error("eval: missing 'var' parameter");
25 return;
26 }
27
28 if($params['var'] == '') {
29 return;
30 }
31
32 $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
33
34 ob_start();
35 $smarty->_eval('?>' . $_var_compiled);
36 $_contents = ob_get_contents();
37 ob_end_clean();
38
39 if (!empty($params['assign'])) {
40 $smarty->assign($params['assign'], $_contents);
41 } else {
42 return $_contents;
43 }
44 }
45
46 /* vim: set expandtab: */
47
48 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed