phpDocumentor Smarty
plugins
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file function.eval.php

Documentation is available at function.eval.php

  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. ?>

Documentation generated on Tue, 24 Oct 2006 09:22:36 -0500 by phpDocumentor 1.3.1