Re: newlines in files
| From: | Monte Ohrt | Date: | Thu, 25 Oct 2001 19:16:11 +0000 |
| Subject: | Re: newlines in files | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1726@lists.php.net to get a copy of this message | ||
If your compiled template ends in a PHP function then you wouldn't have
this problem, it would be eaten by PHP. So I suppose a workaround would
be to put a dummy tag at the end of your template, like {$fooblah} :-)
But if your template ends in plain text (as many templates do), you will
get the newline introduced by text editors in your HTML code. Now Smarty
ensures that the newline is removed in any event.
Currently, when you do this:
{include file="header.tpl"}blah{include file="footer.tpl"}
If the contents of header.tpl ended in plain text, you would get a
newline right before "blah". Now after this fix, it will run everything
together, as you would expect a template to do.
Andrei Zmievski wrote:
>
> On Thu, 25 Oct 2001, Monte Ohrt wrote:
> > 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.
>
> I don't think it was really a problem in Smarty. It wasn't doing
> anything wrong, but this workaround helps to account for the newlines
> that editors put in.
>
> -Andrei
>
> "Tomorrow the sun will rise. And who knows what the tide will bring?"
> - Tom Hanks, in "Cast Away"
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/