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

up vote 10 down vote accepted

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

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

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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