We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Show most recent entries in table in date order?

How Do I?

crossfade's avatar
crossfade
31 posts
8 years ago
crossfade's avatar crossfade

This is one of those things where I’m wondering whether I’m missing the easy answer.

Let’s say I have a channel with lots of entries.

I want to show a table of the most recent 20 entries, but I want to display them in chronological order.

If I use orderby=entry_date sort=”desc” limit=”20” I will get the desired result except the table would be in the wrong order.

It would be: 20, 19, 18 etc.

I want the output to be 1, 2, 3 etc.

It needs to be dynamic in the sense that it always lists the most recent 20 entries (so I can’t hard code specific entry id’s etc.)

Is there a way to achieve what I want?

Thanks!

       
Jeremy S.'s avatar
Jeremy S.
353 posts
8 years ago
Jeremy S.'s avatar Jeremy S.

Should be as simple as changing your sort=”desc” to sort=”asc” (ascending vs descending order).

       
crossfade's avatar
crossfade
31 posts
8 years ago
crossfade's avatar crossfade

Thanks for the response.

The problem there is that choosing asc would list the first 20 entries.

So, to clarify, lets say there are 100 entries.

I want it to list entries 81 - 100 in that order.

I can list those entries in the order 100 - 81 by choosing desc. But if I choose asc, it would list entries 1 - 20, not 81 - 100.

But, when another five entries are added, it would need to list entries 86 - 105 (so I can’t hard code the entry numbers to list)

I’m just trying to get the table to be logical in terms of the most recent entry being the last on the list.

Thanks for any ideas

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.