Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

strip & co.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
tazer
Smarty n00b


Joined: 10 Dec 2003
Posts: 2

PostPosted: Thu Feb 19, 2004 11:25 am    Post subject: strip & co. Reply with quote

Hi,

i've got the following constuction in my template:

strip
..html_image
..a href...
....$var1.$var2.$var3
../a
/strip

in case of $var1 beeing empty there is always white-space (style=underline) between the image and the $var2. the only way I found is to use an if - condition to blind out $var1

is there another option to avoid it?

thx
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Feb 22, 2004 3:05 pm    Post subject: Reply with quote

"$var1.$var2.$var3" is not valid smarty syntax. how does your template actually look?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Sun Feb 22, 2004 5:52 pm    Post subject: Reply with quote

you can guard using the default modifier:

{$var1|default:""}{$var2|default:""} etc.
Back to top
View user's profile Send private message
tazer
Smarty n00b


Joined: 10 Dec 2003
Posts: 2

PostPosted: Mon Feb 23, 2004 8:34 am    Post subject: Reply with quote

Sorry, the dot was supposed to be white-space...

right now I solved the problem like this:

{$data[row].NAME|cat:" "|cat:$data[row].LASTNAME|cat:" "|cat:$data[row].CITY|trim|strip|escape} !?
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Feb 24, 2004 12:17 am    Post subject: Reply with quote

tazer wrote:
Sorry, the dot was supposed to be white-space...

right now I solved the problem like this:

{$data[row].NAME|cat:" "|cat:$data[row].LASTNAME|cat:" "|cat:$data[row].CITY|trim|strip|escape} !?


You might consider the backtick operator here to embed the results in a single string and avoid the |cat:" "|cat: repetitions:

{"`$data[row].NAME` `$data[row].LASTNAME` `$data[row].CITY`"|trim|strip|escape}

I left the |strip and |escape assuming that you need it for safety.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP