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.

Is it possible to order entries by category?

October 30, 2009 11:06am

Subscribe [3]
  • #1 / Oct 30, 2009 11:06am

    metadaptive

    96 posts

    I have an events weblog that uses entry + expiry dates + show_future_entries to display events over time in what I’m sure is a pretty standard way

    I’m using categories to (amoung other things) indicate the venue for the event.

    What I want to do is display all events/entries which are happening today (ie entry date in the past, expiry date in the future) and output them sorted by venue (ie EE category) and then by date within each category.

    I think I’m right that I can’t do that within the normal weblog:entries parameters as order_by=“category_id” doesn’t exist.

    Intitally I thought I could be crafty and use a weblog:category_archive call but that doesn’t allow show_expired=“no” (sensibly enough as it’s an archive tag after all), so that was a no go.

    I’m guessing I could use a query here but last time I tried to do that my brain nearly exploded (despite much patient help from eMan).

    I do have a back up plan if this proves impossible, but before I do that, can anyone see a route that I’ve missed?

  • #2 / Oct 30, 2009 12:29pm

    metadaptive

    96 posts

    I think I’ve just decided to live without sorting by categories as it’s Friday afternoon and I want to stop work some time before midnight…

  • #3 / Oct 30, 2009 3:37pm

    Nick Kutateli

    11 posts

    I haven’t done this before, but off the top of my head this is what i would try:

    {exp:weblog:categories weblog="events" style="linear"}
     <div>
     {category_name}
     <ul>
     {exp:weblog:entries weblog="events" orderby="date" category="{category_id}" show_future_entries="yes"}
      <li>{event}</li>
     {/exp:weblog:entries}
     </ul>
     </div>
    {/exp:weblog:categories}
  • #4 / Oct 31, 2009 6:19am

    rmedek

    131 posts

    What I want to do is display all events/entries which are happening today (ie entry date in the past, expiry date in the future) and output them sorted by venue (ie EE category) and then by date within each category.

    If you move the venue info from categories to another weblog, you can enter the venue on each event entry via a related entries custom field, then order the output by custom field. Not that you want to redo everything, but it’s an idea, plus it gives you more control and the ability for more info added to the venues.

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

ExpressionEngine News!

#eecms, #events, #releases