Re: [SMARTY-DEV] Incorrect newline counters

From: Date: Wed, 02 Jun 2004 07:36:50 +0000
Subject: Re: [SMARTY-DEV] Incorrect newline counters
References: 1 2 3 4 5 6 7 8  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2368@lists.php.net to get a copy of this message
On Tue, Jun 01, 2004 at 04:42:53PM -0500, Monte Ohrt wrote: > I think this rule works: If a tag produces no output, then no newline > should be produced by it. > > examples: > > {$foo} > {$foo2} > {$foo3} > > The above vars should make newlines in the resulting template since they > have output (even if it's empty). > > {assign var="foo" value="bar"} > {assign var="foo2" value="bar2"} > {assign var="foo3" value="bar3"} > {if ...} > {/if} > {include ...} > > The above functions should NOT make newlines in the resulting template, > there is no output. They are purely functional. that's not correct for assign. the rule is not "If a tag produces output then a newline after a right-delimiter is kept" but it is "If a tag *is supposed to* produce then a newline after a right-delimiter is kept" custom-function are supposed to produce output, so the newline after an {assign} won't be slurped. Tags that keep a following newline {$var} {$obj->meth()} {* except when an assign-attribute is given *} {obj->meth foo=bar} {* except when an assign-attribute is given *} {function foo=bar} {* except the built-ins include and include_php *} Tags that slurp a following newline {$obj->meth() assign=var} {obj->meth assign=bar} {obj->block ...} ... {/obj->block} {block} ... {/block} {* including all built-ins like foreach, section, if, literal ... *} {else} {foreachelse} {sectionelse}

« previous php.smarty.dev (#2368) next »