Re: Smarty strips spaces after a tag in one line

From: Date: Sat, 03 Mar 2001 17:00:36 +0000
Subject: Re: Smarty strips spaces after a tag in one line
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-287@lists.php.net to get a copy of this message
I know why this happens, I'm just trying to figure out if there is a good way to work around this. the {strip}{/strip} function was initially designed to run html tags together for browser problems. With html tags, there isn't normally a worry about spacing and newlines since your data is always contained within html. What is happening is the following: First, you tags get converted to PHP: <?php echo $var1; ?>\n to <?php echo $var2; ?>\n (The \n are added because PHP eats those when executed) Then, strip goes ahead and takes off tabs, newlines and spaces immedately preceeding or following newlines. So you end up with: <?php echo $var1; ?>to <?php echo $var2; ?> As you can see, this causes a problem. If everything is within HTML tags, not a problem. We could update strip tags to only match newlines not preceeded by ?>, but I'm not sure what that may impact, because ?> may not necessarily be part of a php command. Jim Harlindong wrote: > > If I have > > {strip} > {$var} to {$var2} > {/strip} > > it will result in: > > $varto $var2 > ^ > > the space after the tag is stripped even though it's in the same line.. is > this by design? > > P.S. Sorry for the sudden flood of emails from me, I just love using smarty > :) > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at ÇZäHÂuÿ€@pº > 7}¼http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

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