You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
PHTML
53 lines
1.7 KiB
PHTML
14 years ago
|
<?php
|
||
|
/**
|
||
|
* Smarty Internal Plugin Compile Append
|
||
|
* Compiles the {append} tag
|
||
13 years ago
|
*
|
||
10 years ago
|
* @package Smarty
|
||
14 years ago
|
* @subpackage Compiler
|
||
10 years ago
|
* @author Uwe Tews
|
||
14 years ago
|
*/
|
||
13 years ago
|
|
||
14 years ago
|
/**
|
||
|
* Smarty Internal Plugin Compile Append Class
|
||
13 years ago
|
*
|
||
10 years ago
|
* @package Smarty
|
||
13 years ago
|
* @subpackage Compiler
|
||
14 years ago
|
*/
|
||
11 years ago
|
class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign
|
||
|
{
|
||
14 years ago
|
/**
|
||
|
* Compiles code for the {append} tag
|
||
13 years ago
|
*
|
||
7 years ago
|
* @param array $args array with attributes from parser
|
||
9 years ago
|
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
|
||
7 years ago
|
* @param array $parameter array with compilation parameter
|
||
10 years ago
|
*
|
||
14 years ago
|
* @return string compiled code
|
||
7 years ago
|
* @throws \SmartyCompilerException
|
||
14 years ago
|
*/
|
||
9 years ago
|
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
|
||
14 years ago
|
{
|
||
14 years ago
|
// the following must be assigned at runtime because it will be overwritten in parent class
|
||
|
$this->required_attributes = array('var', 'value');
|
||
|
$this->shorttag_order = array('var', 'value');
|
||
13 years ago
|
$this->optional_attributes = array('scope', 'index');
|
||
7 years ago
|
$this->mapCache = array();
|
||
14 years ago
|
// check and get attributes
|
||
13 years ago
|
$_attr = $this->getAttributes($compiler, $args);
|
||
14 years ago
|
// map to compile assign attributes
|
||
7 years ago
|
if (isset($_attr[ 'index' ])) {
|
||
|
$_params[ 'smarty_internal_index' ] = '[' . $_attr[ 'index' ] . ']';
|
||
|
unset($_attr[ 'index' ]);
|
||
14 years ago
|
} else {
|
||
7 years ago
|
$_params[ 'smarty_internal_index' ] = '[]';
|
||
14 years ago
|
}
|
||
|
$_new_attr = array();
|
||
|
foreach ($_attr as $key => $value) {
|
||
|
$_new_attr[] = array($key => $value);
|
||
13 years ago
|
}
|
||
14 years ago
|
// call compile assign
|
||
|
return parent::compile($_new_attr, $compiler, $_params);
|
||
13 years ago
|
}
|
||
|
}
|