ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Channel Entry No_Results Conditional

August 25, 2012 8:17am

Subscribe [2]
  • #1 / Aug 25, 2012 8:17am

    Royama Design

    34 posts

    EE 2.4.0

    My channel entry no_results conditional is not returning any content. In fact, I’ve never been able to get this conditional to work. Ever. Not sure why.

    Here is my channel tag code:

    {exp:channel:entries
       disable="categories|category_fields|pagination"
       channel="ch_class_tracker"
       status="open"
       show_future_entries="no"
       show_expired="no"
       author_id="CURRENT_USER"
       require_entry="yes"
       orderby="date"
       sort="asc"
    }
       {if no_results}no results content{/if}
    
       content
    
    {/exp:channel:entries}

    An entry ID is not being passed in the URL on this page. I am pulling up entries based upon the author_id=“CURRENT_USER” param.

    If the author has not created an entry yet, I want the no results content to appear.

  • #2 / Aug 27, 2012 11:54am

    Shane Eckert

    7174 posts

    Hello Sam,

    I am sorry to hear you are running into this problem.

    Can you try a very basic block of code and build from there? In it’s own template just use the following.

    {exp:channel:entries}
    {if no_results}no results content{/if}
       content
    {/exp:channel:entries}

    If you have to, use a new channel that has no content, or create conditions so that there is no content.

    Does the conditional still fail?

    Thank you,

     

  • #3 / Aug 29, 2012 10:47am

    Royama Design

    34 posts

    Hi Shane:

    I did as requested and I did get the proper “no results content” as output.

    I started add to the template to find what was the first problem and it broke the moment I wrapped everything in a Switchee add-on tag.

    Going to go hunting around the support forum for any clues.

     

  • #4 / Aug 29, 2012 10:51am

    Royama Design

    34 posts

    Yeah, this is a known issue; and not unique to Switchee, either. Switchee has a unique no_results tag that solves the problem:

    http://devot-ee.com/add-ons/support/switchee/viewthread/2925

  • #5 / Aug 29, 2012 3:53pm

    Shane Eckert

    7174 posts

    Hey Sam,

    So are you good now? Where are things.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases