Categories > TinyButStrong general >

If then variable problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Austin
Date: 2005-03-27
Time: 05:46

If then variable problem

<a href="[var.page_name;if [val]=Welcome;then 'index';else var.page_name].php">[var.page_name]</a>
I am trying to use an if/then for a link. If the variable value is 'Welcome', I want to replace it with 'index'. This works fine when the variable value is 'Welcome', but when the value is somthing else, it is showing the link as 'var.page_name.php' instead of using the variable value. What am I doing wrong?
By: Skrol29
Date: 2005-03-27
Time: 13:28

Re: If then variable problem

Your var TBS field is not correctly open. It misses the open char.
By: Austin
Date: 2005-03-28
Time: 20:18

Re: If then variable problem

Thanks for the response, but I do not understand what you mean.
By: Skrol29
Date: 2005-03-28
Time: 20:38

Re: If then variable problem

var.page_name]
is wrong, it should be
[var.page_name]
By: Austin
Date: 2005-03-28
Time: 21:36

Re: If then variable problem

Thanks for the help, but I tried that and it did not work:
<a href="[var.page_name;if [val]=Welcome;then 'index';else [var.page_name].php">[var.page_name]</a>
It looks like I am missing a ']'.
So I tried this, but it did not work either:
<a href="[var.page_name;if [val]=Welcome;then 'index';else [var.page_name]].php">[var.page_name]</a>
By: Skrol29
Date: 2005-03-28
Time: 23:54

Re: If then variable problem

The last one should work. Check that you don't have any line-break in you code source over the TBS field.
By: Skrol29
Date: 2005-03-28
Time: 23:58

Re: If then variable problem

Sorry, paremeter 'else' doesn't support var fields, but it supports [val].
This should work:
[var.page_name;if [val]=Welcome;then 'index';else [val]]