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 Categories and no results?

January 24, 2011 4:19pm

Subscribe [3]
  • #1 / Jan 24, 2011 4:19pm

    Ian Ebden

    312 posts

    Is there a “if no_results” equivalent for the channel categories tag? Basically, I have a a “Filed under x” line in my blog template, and for entries not assigned to a category I want to just output something like “Filed under General”.

    Is there a simple way to achieve this, or am I looking at a SQL query? Tried a conditional with {count} or {total_results} < 1 but no joy.

    Suppose I could just create a “General” category and assign those entries, but would be nicer maybe to just handle in the template.

    Any help much appreciated.

  • #2 / Jan 24, 2011 4:55pm

    lebisol

    2234 posts

    If you do not like to use query module then your approach to “General” category (and setting entries to default to that cat) would be the way.
    Remember…you are returning entries not categories when looking into “if no_results”.

  • #3 / Jan 24, 2011 5:42pm

    Ian Ebden

    312 posts

    Yeah thanks lebisol. Think I’ll just go the “General” category route and keep things simple.

  • #4 / Jan 24, 2011 6:12pm

    lebisol

    2234 posts

    Sometimes ‘simple’ is not a bad thing 😊 just set it as default and forget about it. If you ever miss to select cat then you will always fall back for ‘general’...something that query can not do during entry 😉.
    All the best.

  • #5 / Jan 25, 2011 11:01am

    Sue Crocker

    26054 posts

    Thanks for the assist, lebisol.

    Ian, I agree, it’s easiest to set a General category as a catch all.

    Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases