4

I am trying to do something which I suspect is quite simple.

I am referencing a channel field to rerun results to populate a series of check boxes. If there are no results I wish to say 'There are no results".

{exp:channel:entries channel="sales" disable="categories|category-fields|member-data|pagination" status="open" sort="asc"} 
    <label class="checkbox">
       <input type="checkbox" value="{postcode1}">
       {postcode1}
    </label>
    {if no_results}Sorry, No Results{/if}
{/exp:channel:entries}

Any thoughts?

Niall

10

You just need to add require_entry="yes" as a parameter on your opening channel:entries tag and your code should work as expected.

See the documentation on that here.

  • 2
    Maybe worth noting that if you don't have require_entry="yes", the entries tag will default to showing the most recent entries. – unexplainedBacn Dec 3 '12 at 20:01
1

Any chance you are using this in conjunction with Croxton's ifelse plugin (I see you tagged your question with ifelse)? If so, you need to use the {no_results}{/no_results} tag pair instead of the if statement you are using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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