0

I have moved embed code to be a snippet. After that move no_results stopped to work (part of the code below)

{exp:channel:entries channel="products" category="{segment_2_category_id}" orderby="title" sort="asc" limit="8" paginate="bottom" dynamic="no"}

            {if no_results}
                    <div class=""><p>No entries yet.</p></div>
                {/if}

{/exp:channel:entries}

Any clue why it has stopped?

4
  • 2
    Is this code inside switchee?
    – Sobral
    Commented Jan 28, 2014 at 22:58
  • 1. {if no_results} {/if} stop working or it is show all entryes like is no category="{segment_2_category_id}"? 2. needs to see what is around you snippet - possible some add-on has no_results tag also and execute before channel tag.
    – Max Lazar
    Commented Jan 29, 2014 at 10:42
  • @RobsonSobral Correct - it is inside switchee. So I need to go back to embeds instead of snippets? Commented Jan 29, 2014 at 15:28
  • @MaxLazar #1 - Is stop working (blank div) #2 - snippets were used inside switchee Commented Jan 29, 2014 at 15:32

1 Answer 1

1

Well, it is issue related to switchee (thanks Robson Sobral for pointing me to that).

The {if no_results} behaviour is ‘owned’ by the outer wrapping tag not the inner tag. This is an EE bug/feature and not unique to Switchee.

Because of this, Switchee has it’s own no_results handling which will work for each nested switchee layer:

{if switchee_no_results}
...
{/if}  

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

1
  • 1
    Please, mark your answer as right.
    – Sobral
    Commented Jan 29, 2014 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.