conditionals? 
Posted: 24 October 2007 02:40 PM   [ Ignore ]
Newbie
Rank
Total Posts:  12
Joined  2007-09-29

In the docs it states that any of the variables can be used as conditonals, but i’m having trouble getting this to work.

For each of my entries that have been tagged, i would like the output to look like this:
TAGS: tagname - anothertag - sometag

For entries that have not been tagged, i would like the output to look like this:
TAGS: entry has not been tagged

Here is my current code:

TAGS{exp:tag:tags entry_id="{entry_id}" backspace="3" type="weblog" orderby="clicks" sort="desc" limit="10"}{if tag == ""}entry has not been tagged{/if}
<a href="{path={relative_url}/tags/{websafe_tag}}">{tag}</a> -  {/exp:tag:tags}


Any help would be much appreciated, thanks!

Profile
 
 
Posted: 04 November 2007 02:51 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  2
Joined  2007-10-28

I ran into the same issue, until I realized that checking for no values within the loop would be self-defeating: The loop doesn’t execute if there is no tag.

On the flip side, how are we going to address the “no tags available”? I guess we will have to wait until the Solspace people come up with a {no_tags} variable or something similar.

Profile
 
 
Posted: 04 November 2007 03:46 PM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

As far as I can tell there isn’t a no_results conditional; it’s not listed in the docs and it doesn’t work in the templates.  So, I went and figured out how to create a solution.  Tutorial is here.  It works, though it’s not ideal; but it’s a solution that can be used immediately. =)

Obviously customize for your own needs. I wants Tags: only showing if there were results, so this is customized to that end; if you don’t need it, then the conditional on count can be ditched, and just use the if no_results in the query. =)

Profile
 
 
Posted: 04 November 2007 04:03 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  2
Joined  2007-10-28
Lisa Wess - 04 November 2007 03:46 PM

Tutorial is here.

Works like a charm Lisa. Thanks!

Profile