Re: newlines in files

From: Date: Thu, 25 Oct 2001 19:07:16 +0000
Subject: Re: newlines in files
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1724@lists.php.net to get a copy of this message
I found the problem and fixed it for the next release. Now if there is a "\n" at the end of a compiled template, it will be removed. It will only remove one, so if you actally put a "\n" in on purpose, it will show up. Sheldon Jones wrote: > > The {strip} does a good job of stripping the extra lines in a template file > but it misses the one at the end. If you include a template from within > another template you will get new lines in you output even though you > have the strip in both template files. > > I've looked at the code and I think this may do it. > $template_source = chop($this->_read_file($resource_name)); > > The _read_file function is called twice and I'm not sure if it needs to be > chop'd for each call. > > It seems to work ok. > > Any ideas? > > --Sheldon > > On Thu, Oct 25, 2001 at 11:46:02AM -0500, Monte Ohrt wrote: > > It was brought to my attention (by Roberto Berto) that there are > > newlines at the end of the Smarty files. I thought this was a bit odd at > > first, but yes they are in there. But, this seems to be the case with > > any file. > > > > For instance, with the VI editor (I tried nedit too), open a file, type > > "foo", then save it. If you do a raw dump of the file content, you will > > see that it does contain a new line "foo\n". I suppose this is they way > > (any?) editor behaves, putting this in as an EOF marker. > > > > So I'm wondering, is this a concern? Usually this would be a no, as a > > newline in an HTML document doesn't normally cause an issue. But it can, > > and especially if the content is something other than HTML or the > > content is encapsulated somehow. This also goes for all the templates > > you build with Smarty. They all most likely have newlines attached to > > the end. > > > > I'd like so see what other peoples thoughts are on this one. Do we take > > care to remove the newlines from the Smarty class files? This would > > involve a post-stripping of the newline anytime the file is edited I > > would think, unless I'm missing something obvious. > > > > Monte > > > > --- > > You are currently subscribed to smarty as: sheldon@hobbydump.com > > To unsubscribe send a blank email to $subst('Email.Unsub') > > Visit Smarty's homepage at > > http://www.phpinsider.com/php/code/Smarty/ > > -- > --Sheldon > > ------------------------------------------------------ > Sheldon Jones > Systems Administrator > Lobo Internet Services, Ltd. > > mailto:sheldon@hobbydump.com > > Does Microsoft mean "small and limp"? > What's with the 'Intel Inside' warning label anyway? > ------------------------------------------------------ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.smarty.general (#1724) next »