Test for No_results outside exp:weblog:entries?
Posted: 22 March 2005 06:51 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  105
Joined  03-10-2003

Someone else asked this earlier here, but not answered. Trying again:

I want to suppress a DIV if there are no current entries in a category. I can do a test for no_result, but only within the exp:weblog:entries, and that requires that the DIV and the H4 heading be outside it, so far as I can tell.

My test page: http://64.62.135.162/index.php

I want the “News and Events” section, which currently has no entries, to just not get displayed (no H4, no DIV, no nothing) until there actually are entries, rather than what I seem to be stuck with now, showing the text “No current events”.

Is this possible?

thanks!
Peter

 Signature 

Metaphilm | The Trinity Forum | Church of the Apostles

Profile
 
 
Posted: 23 March 2005 11:48 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7534
Joined  08-05-2002

It is not the perfect solution, but you could wrap the {exp:weblog:entries} tag with nearly everything disabled around that div and use the same conditional:

exp:weblog:entries weblog=“weblog1” limit=“15” disable=“categories|custom_fields|member_data|pagination|trackbacks”}

{if no_results}
<div id=“marcoPolo”>
{/if}
{/exp:weblog:entries}

 Signature 
Profile
 
 
Posted: 23 March 2005 03:29 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  105
Joined  03-10-2003

Tried that but it doesn’t seem to work—or rather, it’s backward. Looking over my logic, I want something on the order of a logical “not” for this function—“if NOT no_results” (thus if there are entries), then show this div.

I tried nesting exp:weblog:entries, but that seems not to be allowed.

If not currently possible, I think this would be a good candidate for a feature request. Other ideas?

 Signature 

Metaphilm | The Trinity Forum | Church of the Apostles

Profile
 
 
Posted: 23 March 2005 03:31 PM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  06-19-2002

{exp:weblog:entries weblog=“weblog1” limit=“1” disable=“categories|custom_fields|member_data|pagination|trackbacks”}

<div id=“marcoPolo”>

{/exp:weblog:entries}

It should only appear if there’s content.  The limit will make sure it doesn’t repeat.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 23 March 2005 03:50 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  105
Joined  03-10-2003

That seems to have worked! (I added the required category number to your example and had to repeat this tag twice, to open and close the div.) Not pretty, but functional. Thanks!!

 Signature 

Metaphilm | The Trinity Forum | Church of the Apostles

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64978 Total Logged-in Users: 21
Total Topics: 82016 Total Anonymous Users: 18
Total Replies: 440814 Total Guests: 180
Total Posts: 522830    
Members ( View Memberlist )