[ Index ]

krapohl.info

title

Body

[close]

/pnincludes/Smarty/plugins/ -> function.eval.php (source)

   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  /* vim: set expandtab: */
  35  
  36  ?>


Generated: Wed Feb 16 22:40:07 2005 Cross-referenced by PHPXref 0.6