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