Automatically exported from code.google.com/p/planningalerts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 line
1.1 KiB

  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * Smarty {assign} compiler function plugin
  9. *
  10. * Type: compiler function<br>
  11. * Name: assign<br>
  12. * Purpose: assign a value to a template variable
  13. * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
  14. * (Smarty online manual)
  15. * @author Monte Ohrt <monte at ohrt dot com> (initial author)
  16. * @auther messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
  17. * @param string containing var-attribute and value-attribute
  18. * @param Smarty_Compiler
  19. */
  20. function smarty_compiler_assign($tag_attrs, &$compiler)
  21. {
  22. $_params = $compiler->_parse_attrs($tag_attrs);
  23. if (!isset($_params['var'])) {
  24. $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING);
  25. return;
  26. }
  27. if (!isset($_params['value'])) {
  28. $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING);
  29. return;
  30. }
  31. return "\$this->assign({$_params['var']}, {$_params['value']});";
  32. }
  33. /* vim: set expandtab: */
  34. ?>