3 * Smarty Internal Plugin Templateparser Parse Tree
4 * These are classes to build parse tree in the template parser
8 * @author Thue Kristensen
13 * A complete smarty tag.
16 * @subpackage Compiler
19 class Smarty_Internal_ParseTree_Tag
extends Smarty_Internal_ParseTree
23 * Saved block nesting level
27 public $saved_block_nesting;
30 * Create parse tree buffer for Smarty tag
32 * @param object $parser parser object
33 * @param string $data content
35 public function __construct($parser, $data)
37 $this->parser
= $parser;
39 $this->saved_block_nesting
= $parser->block_nesting_level
;
43 * Return buffer content
45 * @return string content
47 public function to_smarty_php()
53 * Return complied code that loads the evaluated output of buffer content into a temporary variable
55 * @return string template code
57 public function assign_to_var()
59 $var = sprintf('$_tmp%d', ++ Smarty_Internal_Templateparser
::$prefix_number);
60 $tmp = $this->parser
->compiler
->appendCode('<?php ob_start();?>', $this->data
);
61 $tmp = $this->parser
->compiler
->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
62 $this->parser
->compiler
->prefix_code
[] = sprintf("%s", $tmp);