Code

98e696e30e2a8f4eecaa532a98acc395e63bb9f4
[gosa.git] / gosa-core / include / smarty / sysplugins / smarty_internal_compile_append.php
1 <?php
3 /**
4  * Smarty Internal Plugin Compile Append
5  * 
6  * Compiles the {append} tag
7  * 
8  * @package Smarty
9  * @subpackage Compiler
10  * @author Uwe Tews 
11  */
12 /**
13  * Smarty Internal Plugin Compile Append Class
14  */
15 class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign {
17     /**
18      * Compiles code for the {append} tag
19      * 
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
24      */
25     public function compile($args, $compiler, $parameter)
26     {
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']);
38         } else {
39             $_params['smarty_internal_index'] = '[]';
40         }
41         $_new_attr = array();
42         foreach ($_attr as $key => $value) {
43             $_new_attr[] = array($key => $value);
44         } 
45         // call compile assign
46         return parent::compile($_new_attr, $compiler, $_params);
47     } 
48
50 ?>