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

Easy timeframe format for channel:entries tag

Developer Preview

Louis D.'s avatar
Louis D.
6 posts
10 years ago
Louis D.'s avatar Louis D.

Hi there !

I’ve been working with Solspace Calendar add-on and they have this nice easy text format to define time frames for calendar events : https://solspace.com/docs/calendar/date_formatting/ To get events from the last 2 months, I just use

date_range_start="today" date_range_end="2 months"

Back to EE tags, I needed to display entries which are 2 months old maximum, and the only way to do that was by using PHP in the template, as shown in the doc : https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#start-on

It would be nice to have the same easy to use text format to define time frames. I don’t really like using PHP inside a template (for me it’s not part of the best practices in EE).

What do you think ?

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

Hi Louis,

It should be set up so that you can do this:

start_on="-2 months"

Does that work for you?

       
Louis D.'s avatar
Louis D.
6 posts
10 years ago
Louis D.'s avatar Louis D.

Sorry for the late answer.

Yes, that does work 😊 Way better than using PHP, thanks !

I see that it’s also indicated in the documentation now 😊

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

No worries, glad to hear it’s what you needed! Yep this prompted us to update the documentation, we didn’t realize it had been skipped over, so we appreciated you bringing it up!

       

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.