Source for file eval.php

Documentation is available at eval.php

  1. <?php
  2.  
  3. /**
  4.  * Evaluates the given string as if it was a template
  5.  *
  6.  * Although this plugin is kind of optimized and will
  7.  * not recompile your string each time, it is still not
  8.  * a good practice to use it. If you want to have templates
  9.  * stored in a database or something you should probably use
  10.  * the Dwoo_Template_String class or make another class that
  11.  * extends it
  12.  * <pre>
  13.  *  * var : the string to use as a template
  14.  *  * assign : if set, the output of the template will be saved in this variable instead of being output
  15.  * </pre>
  16.  * This software is provided 'as-is', without any express or implied warranty.
  17.  * In no event will the authors be held liable for any damages arising from the use of this software.
  18.  *
  19.  * This file is released under the LGPL
  20.  * "GNU Lesser General Public License"
  21.  * More information can be found here:
  22.  * {@link http://www.gnu.org/copyleft/lesser.html}
  23.  *
  24.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  25.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  26.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  27.  * @link       http://dwoo.org/
  28.  * @version    0.9.1
  29.  * @date       2008-05-30
  30.  * @package    Dwoo
  31.  */
  32. function Dwoo_Plugin_eval(Dwoo $dwoo$var$assign null)
  33. {
  34.     if ($var == ''{
  35.         return;
  36.     }
  37.  
  38.     $tpl new Dwoo_Template_String($var);
  39.     $out $dwoo->get($var$dwoo->readVar('_parent'));
  40.  
  41.     if ($assign !== null{
  42.         $dwoo->assignInScope($out$assign);
  43.     else {
  44.         return $out;
  45.     }
  46. }

Documentation generated on Sat, 28 Jun 2008 01:38:21 +0200 by phpDocumentor 1.4.0