- remove ?>\n<?php and ?><?php sequences from compiled template

This commit is contained in:
Uwe.Tews
2009-10-17 03:36:47 +00:00
parent 81ebefccea
commit 402e3f4272
6 changed files with 9 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
10/17/2009
- remove ?>\n<?php and ?><?php sequences from compiled template
10/15/2009
- buxfix on assigning array elements inside templates
- parser bugfix on array access

View File

@@ -34,7 +34,7 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
if (isset($append)) {
$_output .= " \$_smarty_tpl->append($append, ob_get_contents());";
}
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean(); ?>\n";
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean(); ?>";
return $_output;
}
}

View File

@@ -26,8 +26,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
$_attr = $this->_get_attributes($args);
// display debug template
$_output = "\$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl->smarty);";
return "<?php $_output ?>";
$_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl->smarty); ?>";
return $_output;
}
}

View File

@@ -29,7 +29,7 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
$this->_open_tag('if');
if (is_array($args['if condition'])) {
$_output = " <?php if (!isset(\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$args['if condition']['var']."] = new Smarty_Variable;\n";
$_output .= " if (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value']."): ?>";
$_output .= "if (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value']."): ?>";
return $_output;
} else {
return '<?php if (' . $args['if condition'] . '): ?>';

View File

@@ -138,7 +138,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
} else {
if ($has_compiled_template) {
$_output .= " \$_tpl_stack[] = \$_smarty_tpl; \$_smarty_tpl = \$_template;?>\n";
$_output .= $compiled_tpl . "<?php /* End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>";;
$_output .= $compiled_tpl . "<?php /* End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>";
$_output .= "<?php \$_smarty_tpl = array_pop(\$_tpl_stack);?>";
} else {
$_output .= " echo \$_template->fetch(); ?>";

View File

@@ -63,7 +63,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
if (!$this->compile_error) {
// return compiled code
return $parser->retvalue;
return str_replace(array("?>\n<?php","?><?php"), '', $parser->retvalue);
} else {
// compilation error
return false;