[Tag] ’No results’ conditional
Posted: 30 April 2008 10:56 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  45
Joined  2006-07-16

Would be nice to display ‘no tags’ for an entry. Didn’t see it documented, anyway.

Profile
 
 
Posted: 01 May 2008 06:23 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

I’ll add a conditional for this to the list smile
EDIT: already on the list.... figured it’d be LOL

 Signature 
Profile
 
 
Posted: 24 August 2008 05:45 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  14
Joined  2007-12-12

Any kind of ETA on this? I’d even be willing to hack it in if you show me what code to insert where… wink I’d think it would be a near-duplicate of the exp:weblog:entries’ {no_results} conditional.

Then again, I don’t know anything about EE internal code structure. rasberry

Profile
 
 
Posted: 25 August 2008 07:22 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

I’ve actually found a way around this guys smile

The {if no_results} conditional actually works for Tag:Tags, it’s just thatit collides with the Weblog:Entries loop, and appears not to work.
You can simply avoid this by doing either of these:

1) If on a Single Entry Template, place the Tag:Tags loop outside of the Weblog Entries loop smile

OR (and this would be a case where if you wanted the Tags showing up in a list of Weblog Entries, where the Tag:Tags loop would need to be placed in the Weblog:Entries loop)

2) Use an embed: smile

Main template:

{exp:weblog:entries}
<h1>{title}</h1>
<
p>{body}</p>
{embed="path_to/tags_embed" entryid="{entry_id}"}
{
/exp:weblog:entries}

Embedded Template:

{exp:tag:tags entry_id="{embed:entryid}" type="weblog" orderby="clicks" sort="desc" limit="5"}
{if no_results}
<p>Not Tagged</p>{/if}
{
/exp:tag:tags}

 Signature 
Profile
 
 
Posted: 05 October 2008 03:32 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  15
Joined  2007-08-07

I want to put my article tags in a css box like this :

<div class="tagsarticle" id="boitetag">
{exp:tag:tags entry_id="{entry_id}" backspace="1" type="weblog" orderby="clicks" sort="desc" limit="10"}
{if no_results}
No result
!
{/if}
<a href="{path=/sdg/tags/tag}{websafe_tag}" title="{tag_name}" >{tag}</a> |
{/exp:tag:tags}
</div>

If I have no tags, I want to hide the “boitetag” div.

Actually i have this :

...
{if no_results}

var objet = document.getElementById('boitetag');
objet.style.display = "none";
{/if}
...

is it possible to do this without javascript code ?
I try with {count}==1 and {count}== {total_result} without success.

Profile
 
 
Posted: 06 October 2008 06:38 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

jpol,

I see… there is currently no “clean” way to do this, other than if your method works, stick with it.

 Signature 
Profile