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 Future events from around now

Development and Programming

Chris Jennings's avatar
Chris Jennings
87 posts
17 years ago
Chris Jennings's avatar Chris Jennings

I was getting a bit irritated having to enable PHP and get the current time to use the start_on and show_future_entries feature of the weblogs tag.

I have created a plug-in that avoids all of that. Mind you, I had to use an un-documented feature to get it to work.

I call it AroundNow. Here is an example of its use:

{exp:weblog:entries weblog="events start_on="{exp:aroundnow goback='12'}" parse="inward" show_future_entries="yes" sort="asc"}
{title}
{/exp:weblog:entries}

There is one parameter: goback - so:

goback='12'

will start the events listing from 12 hours ago. This is just in case you want to keep the event ‘alive’ for at least part of a day.

I am dropping it here in case it might be of use to anyone. Make sure you put the hours in single quotes and remember to use show_future_entries=”yes”.

I have only tested on EE version 1.52

CJ

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

If you don’t need the “goback” parameter, you don’t have to use PHP to provide the current time to start_on=, you just need the latest version of ExpressionEngine and use the {current_time} variable.

       
Chris Jennings's avatar
Chris Jennings
87 posts
17 years ago
Chris Jennings's avatar Chris Jennings

Thanks Derek I hadn’t spotted that. I do need to be able to go back a touch though because, if an event is happening today I want it to show up in the list until the end of the day.

I haven’t upgraded any of my sites to 1.6 yet!

CJ

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
17 years ago
Sue Crocker's avatar Sue Crocker

current_time is a cool thing, but what I really need is current_time at 12:01am. 😊

Edit:

HowTo:// Display Events Starting on the Current Day

       
Chris Jennings's avatar
Chris Jennings
87 posts
17 years ago
Chris Jennings's avatar Chris Jennings

Thanx Sue OK you convinced me to upgrade. 1.6 here I come! 😖

       

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.