mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- added scope to Smarty variables in the {block} tag compiler
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
11/12/2009
|
||||
- fixed variable filenames in {include_php} and {insert}
|
||||
- added scope to Smarty variables in the {block} tag compiler
|
||||
|
||||
11/11/2009
|
||||
- fixed {foreachelse}, {forelse}, {sectionelse} compiled code at nocache variables
|
||||
|
@@ -43,20 +43,20 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase {
|
||||
for ($i = 0; $i < $block_count; $i++) {
|
||||
$block_content = str_replace($this->smarty->left_delimiter . '$smarty.parent' . $this->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
|
||||
substr($_old_source, $s[0][$i][1] + strlen($s[0][$i][0]), $c[0][$i][1] - $s[0][$i][1] - strlen($s[0][$i][0])));
|
||||
$this->saveBlockData($block_content, $s[0][$i][0]);
|
||||
$this->saveBlockData($block_content, $s[0][$i][0],$compiler->template);
|
||||
}
|
||||
$compiler->template->template_source = $_template->getTemplateSource();
|
||||
$compiler->abort_and_recompile = true;
|
||||
return ' ';
|
||||
}
|
||||
|
||||
protected function saveBlockData($block_content, $block_tag)
|
||||
protected function saveBlockData($block_content, $block_tag,$template)
|
||||
{
|
||||
if (0 == preg_match('/(.?)(name=)([^ ]*)/', $block_tag, $_match)) {
|
||||
$this->compiler->trigger_template_error("\"" . $block_tag . "\" missing name attribute");
|
||||
} else {
|
||||
// compile block content
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $block_content);
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $block_content,null,null,$template);
|
||||
$_tpl->template_filepath = $this->compiler->template->getTemplateFilepath();
|
||||
// $_tpl->suppressFileDependency = true;
|
||||
$_compiled_content = $_tpl->getCompiledTemplate();
|
||||
|
@@ -95,7 +95,7 @@ class Smarty_Internal_Resource_Extend {
|
||||
for ($_i = 0; $_i < $_block_count; $_i++) {
|
||||
$_block_content = str_replace($this->smarty->left_delimiter . '$smarty.parent' . $this->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
|
||||
substr($_content, $_open[0][$_i][1] + strlen($_open[0][$_i][0]), $_close[0][$_i][1] - $_open[0][$_i][1] - strlen($_open[0][$_i][0])));
|
||||
$this->saveBlockData($_block_content, $_open[0][$_i][0]);
|
||||
$this->saveBlockData($_block_content, $_open[0][$_i][0],$this->template);
|
||||
}
|
||||
} else {
|
||||
$template->template_source = $_content;
|
||||
@@ -103,13 +103,13 @@ class Smarty_Internal_Resource_Extend {
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function saveBlockData($block_content, $block_tag)
|
||||
protected function saveBlockData($block_content, $block_tag,$template)
|
||||
{
|
||||
if (0 == preg_match('/(.?)(name=)([^ ]*)/', $block_tag, $_match)) {
|
||||
$this->smarty->trigger_error("\"" . $block_tag . "\" missing name attribute");
|
||||
} else {
|
||||
// compile block content
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $block_content);
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $block_content,null,null,$template);
|
||||
$_tpl->template_filepath = $this->template->getTemplateFilepath();
|
||||
// $_tpl->suppressFileDependency = true;
|
||||
$_compiled_content = $_tpl->getCompiledTemplate();
|
||||
|
Reference in New Issue
Block a user