Re: Incorrect newline counters

messju mohr <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
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}

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.