|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
tazer Smarty n00b
Joined: 10 Dec 2003 Posts: 2
|
Posted: Thu Feb 19, 2004 11:25 am Post subject: strip & co. |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Feb 22, 2004 3:05 pm Post subject: |
|
|
"$var1.$var2.$var3" is not valid smarty syntax. how does your template actually look? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Feb 22, 2004 5:52 pm Post subject: |
|
|
you can guard using the default modifier:
{$var1|default:""}{$var2|default:""} etc. |
|
Back to top |
|
tazer Smarty n00b
Joined: 10 Dec 2003 Posts: 2
|
Posted: Mon Feb 23, 2004 8:34 am Post subject: |
|
|
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 |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Feb 24, 2004 12:17 am Post subject: |
|
|
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 |
|
|
|
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
|