Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

smarty_internal_compile_append.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Compile Append
  4. * Compiles the {append} tag
  5. *
  6. * @package Smarty
  7. * @subpackage Compiler
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * Smarty Internal Plugin Compile Append Class
  12. *
  13. * @package Smarty
  14. * @subpackage Compiler
  15. */
  16. class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign
  17. {
  18. /**
  19. * Compiles code for the {append} tag
  20. *
  21. * @param array $args array with attributes from parser
  22. * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
  23. * @param array $parameter array with compilation parameter
  24. *
  25. * @return string compiled code
  26. */
  27. public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
  28. {
  29. // the following must be assigned at runtime because it will be overwritten in parent class
  30. $this->required_attributes = array('var', 'value');
  31. $this->shorttag_order = array('var', 'value');
  32. $this->optional_attributes = array('scope', 'index');
  33. // check and get attributes
  34. $_attr = $this->getAttributes($compiler, $args);
  35. // map to compile assign attributes
  36. if (isset($_attr['index'])) {
  37. $_params['smarty_internal_index'] = '[' . $_attr['index'] . ']';
  38. unset($_attr['index']);
  39. } else {
  40. $_params['smarty_internal_index'] = '[]';
  41. }
  42. $_new_attr = array();
  43. foreach ($_attr as $key => $value) {
  44. $_new_attr[] = array($key => $value);
  45. }
  46. // call compile assign
  47. return parent::compile($_new_attr, $compiler, $_params);
  48. }
  49. }