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

Help with listing entries by custom field

Development and Programming

christaylor's avatar
christaylor
1 posts
15 years ago
christaylor's avatar christaylor

Hi guys

I’m looking for some help with a problem on a client site.

I have a weblog for events and a custom date field for the date the event occurs.

What I want to be able to do is have a list in a sidebar with an archived list of previous events like this:

PREVIOUS EVENTS Dec 2010 Nov 2010 Oct 2010 Sep 2010 …

with each date a link which goes through to a page with a list of events for that month.

I can achieve this by using the entry date but not a custom date field - can anyone point me in the right direction.

Will I have to use some sort of custom database query?

(I’m using EE 1.6)

Many Thanks

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
15 years ago
Kevin Cupp's avatar Kevin Cupp

Yes you’d need to use a custom query and some PHP. Basically, you’d loop through your entries keeping track of which month+year combinations actually exist, then format and sort the text, then create a link to a template which accepts a date as a segment variable which you then plug into the search parameter of your exp:channel:entries tag pair.

Basically, it’s not something we can quickly show you, but it’s possible for you to do. For the sites I work on with my team, we always try to use entry_date and expiration_date for events channels simply because it just makes things so easy. So I would try to figure out how to use those dates for your site, but I understand if you’re unable to use those.

       
blueAlien's avatar
blueAlien
11 posts
15 years ago
blueAlien's avatar blueAlien

Also, if you have a lot of data that is coming from a few different channels that needs to be processed, you could output the data in JSON format in the template, and then use javascript sorting on the page itself.

I just went through this on a project where I had to sort a bunch of events based on different metrics… JavaScript ended up being much faster than having EE pre-sort it all, plus EE wouldn’t sort my custom fields.

       
christaylor's avatar
christaylor
1 posts
15 years ago
christaylor's avatar christaylor

Thanks guys - now I understand it a bit better I’ll give it a go.

       

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.