Re: behavior of newlines following template tags
| From: | Monte Ohrt | Date: | Fri, 09 Feb 2001 14:33:30 +0000 |
| Subject: | Re: behavior of newlines following template tags | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-102@lists.php.net to get a copy of this message | ||
Joris Trooster wrote:
>
> But what if we want to have some code that gives an output like this:
>
> The first line
> E-mail: name@domain.com
> The next line
>
> The first line
> E-mail: Your e-mail address isn't given.
> The next line
>
> I would (expect to) do something like this:
>
> The first line
> E-mail: {if $email}{$email}
> {else}Your e-mail address isn't given.
> {/if}
> The next line
>
This would work (if we keep newlines only on tags with output):
The first line
{if $email}
Email: {$email}
{else}
Email: Your e-mail address isn't given.
{/if}
The next line
But then we are duplicating data in the template, something that may not
scale well with other situations.
Remember, you always have the {strip} tags at your disposal. So this
would work with the current version of Smarty:
The first line
{strip}
Email:
{if $email}
{$email}
{else}
Your e-mail address isn't given.
{/if}
{/strip}
The next line