fixed problem with newline at the end of compiled templates

This commit is contained in:
mohrt
2001-10-25 19:04:05 +00:00
parent edbc22d1bc
commit 32b9ebfa68
5 changed files with 11 additions and 2 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- fixed problem with newline at the end of included templates (Monte, Andrei)
- added feature to regenerate cache if compile_check is enabled and an - added feature to regenerate cache if compile_check is enabled and an
involved template or config file gets modified (Monte) involved template or config file gets modified (Monte)
- added DEBUG execution times to included files (Monte) - added DEBUG execution times to included files (Monte)

View File

@@ -198,7 +198,7 @@ class Smarty
var $_compile_id = null; // for different compiled templates var $_compile_id = null; // for different compiled templates
var $_smarty_debug_id = 'SMARTY_DEBUG'; // text in URL to enable debug mode var $_smarty_debug_id = 'SMARTY_DEBUG'; // text in URL to enable debug mode
var $_smarty_debug_info = array(); // debugging information for debug console var $_smarty_debug_info = array(); // debugging information for debug console
var $_cache_info = array(); // templates that make up a cache file var $_cache_info = array(); // info that makes up a cache file
/*======================================================================*\ /*======================================================================*\

View File

@@ -163,6 +163,10 @@ class Smarty_Compiler extends Smarty {
$template_header .= " compiled from ".$tpl_file." */ ?>\n"; $template_header .= " compiled from ".$tpl_file." */ ?>\n";
$template_compiled = $template_header.$template_compiled; $template_compiled = $template_header.$template_compiled;
// remove \n from the end of the file, if any
if ( $template_compiled{strlen($template_compiled)-1} == "\n" ) {
$template_compiled = substr($template_compiled,0,-1);
}
// run compiled template through postfilter functions // run compiled template through postfilter functions
if (is_array($this->postfilter_funcs) && count($this->postfilter_funcs) > 0) { if (is_array($this->postfilter_funcs) && count($this->postfilter_funcs) > 0) {

View File

@@ -198,7 +198,7 @@ class Smarty
var $_compile_id = null; // for different compiled templates var $_compile_id = null; // for different compiled templates
var $_smarty_debug_id = 'SMARTY_DEBUG'; // text in URL to enable debug mode var $_smarty_debug_id = 'SMARTY_DEBUG'; // text in URL to enable debug mode
var $_smarty_debug_info = array(); // debugging information for debug console var $_smarty_debug_info = array(); // debugging information for debug console
var $_cache_info = array(); // templates that make up a cache file var $_cache_info = array(); // info that makes up a cache file
/*======================================================================*\ /*======================================================================*\

View File

@@ -163,6 +163,10 @@ class Smarty_Compiler extends Smarty {
$template_header .= " compiled from ".$tpl_file." */ ?>\n"; $template_header .= " compiled from ".$tpl_file." */ ?>\n";
$template_compiled = $template_header.$template_compiled; $template_compiled = $template_header.$template_compiled;
// remove \n from the end of the file, if any
if ( $template_compiled{strlen($template_compiled)-1} == "\n" ) {
$template_compiled = substr($template_compiled,0,-1);
}
// run compiled template through postfilter functions // run compiled template through postfilter functions
if (is_array($this->postfilter_funcs) && count($this->postfilter_funcs) > 0) { if (is_array($this->postfilter_funcs) && count($this->postfilter_funcs) > 0) {