mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- added \n to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source
This commit is contained in:
@@ -70,3 +70,7 @@ Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template
|
|||||||
This is now used also on modifiers like escape as default charset. If your templates use
|
This is now used also on modifiers like escape as default charset. If your templates use
|
||||||
other charsets make sure that you define the constant accordingly. Otherwise you may not
|
other charsets make sure that you define the constant accordingly. Otherwise you may not
|
||||||
get any output.
|
get any output.
|
||||||
|
|
||||||
|
== newline at {if} tags ==
|
||||||
|
A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
|
||||||
|
If one of the {if} tags is at the line end you will now get a newline in the HTML output.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
01/11/2010
|
01/11/2010
|
||||||
- added \n to the compiled code of the {/if} tag to get output of newlines as expected by the template source
|
- added \n to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source
|
||||||
|
|
||||||
01/09/2010
|
01/09/2010
|
||||||
- bugfix on nocache {block} tags in parent templates
|
- bugfix on nocache {block} tags in parent templates
|
||||||
|
@@ -31,7 +31,7 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
|||||||
$_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;
|
return $_output;
|
||||||
} else {
|
} else {
|
||||||
return '<?php if (' . $args['if condition'] . '){?>';
|
return "<?php if ({$args['if condition']}){?>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
|
|||||||
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'elseif'));
|
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'elseif'));
|
||||||
$this->_open_tag('else',array($nesting,$compiler->tag_nocache));
|
$this->_open_tag('else',array($nesting,$compiler->tag_nocache));
|
||||||
|
|
||||||
return '<?php }else{ ?>';
|
return "<?php }else{ ?>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,13 +79,13 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
|||||||
|
|
||||||
if (empty($this->compiler->prefix_code)) {
|
if (empty($this->compiler->prefix_code)) {
|
||||||
$this->_open_tag('elseif', array($nesting, $compiler->tag_nocache));
|
$this->_open_tag('elseif', array($nesting, $compiler->tag_nocache));
|
||||||
return '<?php }elseif(' . $args['if condition'] . '){?>';
|
return "<?php }elseif({$args['if condition']}){?>\n";
|
||||||
} else {
|
} else {
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
foreach ($this->compiler->prefix_code as $code) $tmp .= $code;
|
foreach ($this->compiler->prefix_code as $code) $tmp .= $code;
|
||||||
$this->compiler->prefix_code = array();
|
$this->compiler->prefix_code = array();
|
||||||
$this->_open_tag('elseif', array($nesting + 1, $compiler->tag_nocache));
|
$this->_open_tag('elseif', array($nesting + 1, $compiler->tag_nocache));
|
||||||
return '<?php }else{?>' . $tmp . '<?php if (' . $args['if condition'] . '){?>';
|
return "<?php }else{?>{$tmp}<?php if ({$args['if condition']}){?>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
|
|||||||
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'else', 'elseif'));
|
list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'else', 'elseif'));
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
for ($i = 0; $i < $nesting ; $i++) $tmp .= '}';
|
for ($i = 0; $i < $nesting ; $i++) $tmp .= '}';
|
||||||
return "<?php $tmp?>\n";
|
return "<?php {$tmp}?>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user