4  * Smarty Internal Plugin Compile Append
 
   6  * Compiles the {append} tag
 
  13  * Smarty Internal Plugin Compile Append Class
 
  15 class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign {
 
  18      * Compiles code for the {append} tag
 
  20      * @param array $args array with attributes from parser
 
  21      * @param object $compiler compiler object
 
  22      * @param array $parameter array with compilation parameter
 
  23      * @return string compiled code
 
  25     public function compile($args, $compiler, $parameter)
 
  27         $this->compiler = $compiler;
 
  28         // the following must be assigned at runtime because it will be overwritten in parent class
 
  29         $this->required_attributes = array('var', 'value');
 
  30         $this->shorttag_order = array('var', 'value');
 
  31         $this->optional_attributes = array('scope','index');
 
  32         // check and get attributes
 
  33         $_attr = $this->_get_attributes($args); 
 
  34         // map to compile assign attributes
 
  35         if (isset($_attr['index'])) {
 
  36             $_params['smarty_internal_index'] = '[' . $_attr['index'] . ']';
 
  37             unset($_attr['index']);
 
  39             $_params['smarty_internal_index'] = '[]';
 
  42         foreach ($_attr as $key => $value) {
 
  43             $_new_attr[] = array($key => $value);
 
  45         // call compile assign
 
  46         return parent::compile($_new_attr, $compiler, $_params);