21287 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1202 Views |
-
Display link only if link URL not empty

13 May 2009 at 4:14am
If (( $LinkURL is not empty ) and ( $LinkText is not empty )) then I want to display the link with the link text inside.
<a href="$LinkURL.ATT" title="$LinkText.ATT">$LinkText.ATT</a>
Else if (( $LinkURL is empty ) and ( $LinkText is not empty )) then I want to display the link text but I don't want it to be a link.
Else if (( $LinkURL is empty and $LinkText is empty )) then I don't want to display anything.
-
Re: Display link only if link URL not empty

13 May 2009 at 10:31pm
There are 2 ways of doing this, you can either use the build in template conditionals or you can write a function of your own to test which are empty and return the appropriate values.
To do it in the template you can do this:
<% if LinkText %>
<% if LinkURL %>
<a href="$LinkURL.ATT" title="$LinkText.ATT">$LinkText.ATT</a>
<% else %>
$LinkText
<% end_if %>
<% end_if %>Not particularly pretty but will do the job.
| 1202 Views | ||
|
Page:
1
|
Go to Top |


