diff --git a/libs/sysplugins/internal.compile_block.php b/libs/sysplugins/internal.compile_block.php index b4092eb3..67077ada 100644 --- a/libs/sysplugins/internal.compile_block.php +++ b/libs/sysplugins/internal.compile_block.php @@ -23,7 +23,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { { $this->compiler = $compiler; $this->required_attributes = array('name'); - $this->optional_attributes = array('assign','append','prepend'); + $this->optional_attributes = array('assign'); // check and get attributes $_attr = $this->_get_attributes($args); $save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code); diff --git a/libs/sysplugins/internal.compile_blockclose.php b/libs/sysplugins/internal.compile_blockclose.php index 7cc00611..97c9e8bc 100644 --- a/libs/sysplugins/internal.compile_blockclose.php +++ b/libs/sysplugins/internal.compile_blockclose.php @@ -34,9 +34,9 @@ class Smarty_Internal_Compile_BlockClose extends Smarty_Internal_CompileBase { $this->compiler->trigger_template_error('mismatching name attributes "' . $saved_data[0]['name'] . '" and "' . $_attr['name'] . '"'); } $_name = trim($saved_data[0]['name'], "'"); - if (isset($saved_data[0]['append'])) { + if ($compiler->template->block_data[$_name]['mode'] == 'prepend') { $_output = $compiler->template->block_data[$_name]['compiled'].$compiler->template->extracted_compiled_code; - } elseif (isset($saved_data[0]['prepend'])) { + } elseif ($compiler->template->block_data[$_name]['mode'] == 'append') { $_output = $compiler->template->extracted_compiled_code.$compiler->template->block_data[$_name]['compiled']; } elseif (!empty($compiler->template->block_data[$_name])) { $_output = $compiler->template->block_data[$_name]['compiled']; diff --git a/libs/sysplugins/internal.compile_extend.php b/libs/sysplugins/internal.compile_extend.php index 4754d167..4219c39d 100644 --- a/libs/sysplugins/internal.compile_extend.php +++ b/libs/sysplugins/internal.compile_extend.php @@ -26,7 +26,7 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase { $this->required_attributes = array('file'); // check and get attributes $_attr = $this->_get_attributes($args); - $_smarty_tpl = $compiler->template; + $_smarty_tpl = $compiler->template; // $include_file = ''; eval('$include_file = ' . $_attr['file'] . ';'); // create template object @@ -53,16 +53,25 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase { $tpl->suppressHeader = false; $_name = trim($_match[3], "\"'"); - if (preg_match('/(.?)(append=true)(.*)/', $matches[2], $_match) != 0) { + if ($this->compiler->template->block_data[$_name]['mode'] == 'prepend') { $this->compiler->template->block_data[$_name]['compiled'] .= $compiled_content; $this->compiler->template->block_data[$_name]['source'] .= $matches[3]; - } elseif (preg_match('/(.?)(prepend=true)(.*)/', $matches[2], $_match) != 0) { + } elseif ($this->compiler->template->block_data[$_name]['mode'] == 'append') { $this->compiler->template->block_data[$_name]['compiled'] = $compiled_content . $this->compiler->template->block_data[$_name]['compiled']; $this->compiler->template->block_data[$_name]['source'] = $matches[3] . $this->compiler->template->block_data[$_name]['source']; } elseif (!isset($this->compiler->template->block_data[$_name])) { $this->compiler->template->block_data[$_name]['compiled'] = $compiled_content; $this->compiler->template->block_data[$_name]['source'] = $matches[3]; } + if ($this->compiler->template->block_data[$_name]['mode'] != 'replace') { + if (preg_match('/(.?)(append=true)(.*)/', $matches[2], $_match) != 0) { + $this->compiler->template->block_data[$_name]['mode'] = 'append'; + } elseif (preg_match('/(.?)(prepend=true)(.*)/', $matches[2], $_match) != 0) { + $this->compiler->template->block_data[$_name]['mode'] = 'prepend'; + } else { + $this->compiler->template->block_data[$_name]['mode'] = 'replace'; + } + } } } }