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.

category_group / categories question

May 14, 2012 11:51pm

Subscribe [1]
  • #1 / May 14, 2012 11:51pm

    Adam George

    283 posts

    I have two category groups (let’s say the ID’s are 1 and 2).

    Inside category group ID 2, are the following category ID’s: 32|40|41|42|48

    I have an some entries which have a category from just one group, and others which have categories from both groups.

    I would like to display 3 entries, but only those entries which are assigned to ONE and ONLY ONE group.

    So entries with categories in group 1 only should be shown. Entries with categories in group 1 and 2 should NOT be shown.

    Is this possible?

    I have tried the following combinations without success (for brevity, tags shown here not closed):

    {exp:channel:entries channel="news" category_group="1" limit="3" orderby="event_start|date" sort="desc" dynamic="no" disable="member_data|pagination"}
    
    {exp:channel:entries channel="news" category_group="not 2" limit="3" orderby="event_start|date" sort="desc" dynamic="no" disable="member_data|pagination"}
    
    {exp:channel:entries channel="news" category_group="1" categories="not 32|40|41|42|48" limit="3" orderby="event_start|date" sort="desc" dynamic="no" disable="member_data|pagination"}

    Please advise, thanks.

    NOTE: Not sure if this works but it’s not an option, as I need to return exactly 3 entries:

    {exp:channel:entries channel="news" category_group="1" limit="3" orderby="event_start|date" sort="desc" dynamic="no" disable="member_data|pagination"}
    {categories show_group="2"}

     

  • #2 / May 16, 2012 11:38am

    Dan Decker

    7338 posts

    Hi Adam,

    I have racked my brain over this one and the only solution I can come up with involves using the Query module.

    Any order of specificity loses the limit of exactly “3” that you need. Look over the list of Category Add-ons available, there may be a nugget I missed in there.

    Cheers,

  • #3 / May 16, 2012 12:02pm

    Adam George

    283 posts

    Thanks Dan. No worries, thanks for thinking about it anyway.

  • #4 / May 18, 2012 6:07pm

    Dan Decker

    7338 posts

    Hi Adam,

    Is there anything else I can assist you with?

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases