Example #1
0
 /**
  * Constructor
  *
  * @param string $tmplPath
  * @param array $extraParams
  * @return void
  */
 public function __construct($tmplPath = null, $extraParams = array())
 {
     $this->_smarty = new Smarty();
     if (null !== $tmplPath) {
         $this->setScriptPath($tmplPath);
     }
     foreach ($extraParams as $key => $value) {
         $this->_smarty->{$key} = $value;
     }
     $this->_smarty->register_compiler_function('helper', array($this, 'helper'));
     $this->_smarty->assign('_helper', $this);
 }
Example #2
0
 /**
  * Register compiler function
  *
  * @param string $function Name of template function
  * @param string $functionImpl Name of PHP function to register
  * @param boll $cacheable Default is true. When registering a plugin with $cacheable=false the plugin is 
  *                        called everytime the page is displayed, even if the page comes from the cache
  * @return void
  * 
  * @example 
  *        - register in register() function:
  *             $this->registerCompilerFunction('funcName', array('NameofRegisterClass', 'functionOfRegisterClass'));
  *        - using in template:
  *              {{* template with Smarty engine *}}
  *              {{funcName param1='This is param1' param2='This is param2'}}
  */
 public function registerCompilerFunction($function, $functionImpl, $cacheable = true)
 {
     $this->_smarty->register_compiler_function($function, $functionImpl, $cacheable);
 }
Example #3
0
 /**
  * sfSmarty::registerCompilerFunction()
  * this is an access function to the internal smarty instance
  * to register a compiler function
  *
  * @param mixed $tag
  * @param mixed $function
  * @return
  **/
 public static function registerCompilerFunction($tag, $function)
 {
     self::$smarty->register_compiler_function($tag, $function);
 }