Categories > TinyButStrong general >

conditional display leaves '' characters in html

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: baz
Date: 2008-04-17
Time: 16:56

conditional display leaves '' characters in html

i have a problem with the following code:

[var.loggedin;if [val]=0;then '
  <a href="#" onclick="javascript:window_spawn('login');">login</a>&nbsp;|&nbsp;
  ';else '
  <a href="#" onclick="javascript:window_spawn('logout');">logout</a>&nbsp;|&nbsp;
  <a href="#" onclick="javascript:window_spawn('profiel');">profiel</a>&nbsp;|&nbsp;
  ']

it does worm, in the sense that it does display either the login or the logout/profile buttons based on the loggedin variable; however, it also prints the '' chars in the "then 'bla'; else 'bla'" line. kinda weird!

anyone any id?
By: baz
Date: 2008-04-17
Time: 16:59

Re: conditional display leaves '' characters in html

*worm == work
By: Skrol29
Date: 2008-04-17
Time: 17:20

Re: conditional display leaves '' characters in html

Hello,

The problem is the quotes. You must double them if they are embbeded into quotes.
[var.loggedin;if [val]=0;then '
<a ... ''login'' ...>
<a ... ''logout'' ...>
<a ... ''profile'' ...>
']

You can do the same using conditional blocks instead of one conditional field.
<span> [onshow_log;block=span;when [val]=0] <a ...> </span>
<span> [onshow_log;block=span;default] <a ...> <a ...> </span>
By: baz
Date: 2008-04-17
Time: 18:45

Re: conditional display leaves '' characters in html

thanks a lot! double quotes, should've known ;)