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

These channel entries appear to be always one step behind

Development and Programming

matteobug's avatar
matteobug
4 posts
14 years ago
matteobug's avatar matteobug

Hi everyone.

I’m running on EE 2.3.1 and I’m having troubles with this template (PHP enabled and set on “input”):

<?php
        $start_time = $this->EE->localize->decode_date('%Y-%m-%d 00:00', mktime(0, 0, 0, date("m"), date("d")+1, date("Y")));
        $stop_time = $this->EE->localize->decode_date('%Y-%m-%d 23:59', mktime(0, 0, 0, date("m"), date("d")+1, date("Y")));
?>

{exp:channel:entries channel="appuntamenti" start_on="<?php echo $start_time; ?>" stop_before="<?php echo $stop_time; ?>" show_future_entries="yes" orderby="date" sort="asc"}
 {exp:calendar_reminder:add time="{entry_date format="%H:%i"}" title="{title}"}
{/exp:channel:entries}
 
{exp:calendar_reminder:send}

What I’m trying to do is to use the channel “appuntamenti” as a small calendar, and I use the entry_date as the date and time of the event on the calendar. “calendar_reminder” is a plugin I developed; “add” adds the entry_date and title to a freeform table; “send” loads the events from freeform, sends them via e-mail and cleans them up. The channel:entries loop should find any entry scheduled on the next day and pass it to my plugin for sending.

The problem I’m ruinning into is that every time I run this template, it looks like it’s one step behind: if I change the date of a “appuntamenti” entry so that it should show up, on the first run it doesn’t work. If I run the template one more time, without changing anything, then the entry show up.

Any insights? Am I missing anything here?

       
matteobug's avatar
matteobug
4 posts
14 years ago
matteobug's avatar matteobug

I’ve got a quick update. I tried to change the sorting from “asc” do “desc”, and I had the same problem: first run, no change; another run, I see the corrects results.

Could this have to do with chache? The template cache is disabled, and I’ve even tried adding cache=”no” to the exp:channel:entries tag, but the issue is still there.

       
Dan Decker's avatar
Dan Decker
7,338 posts
14 years ago
Dan Decker's avatar Dan Decker

Hi matteobug,

Could this have to do with chache?

I suspect so, but your browser’s cache rather than ExpressionEngine’s

If you clear your browser cache before visiting the template, do you still see the issue?

Cheers,

       
matteobug's avatar
matteobug
4 posts
14 years ago
matteobug's avatar matteobug

I was actually already trying with my cache disabled. Tried on different browsers as well. The issue is still there.

Any idea?

       
Kevin Smith's avatar
Kevin Smith
4,784 posts
14 years ago
Kevin Smith's avatar Kevin Smith

Hi matteobug,

Since this involves some custom PHP and a custom add-on, we’re not going to be able to provide support in these forums. I’d be more than happy to move this thread over to the Development and Programming forum if you like, and others devs can help you troubleshoot this.

       
matteobug's avatar
matteobug
4 posts
14 years ago
matteobug's avatar matteobug

Sure, that’d be great, thanks.

By the way, I found a way around the bug. Apparently, this would output the wrong information:

{exp:channel:entries channel="appuntamenti" start_on="<?php echo $start_time; ?>" stop_before="<?php echo $stop_time; ?>" show_future_entries="yes" orderby="date" sort="asc"}
 {exp:calendar_reminder:add time="{entry_date format="%H:%i"}" title="{title}"}
{/exp:channel:entries}

as the plugin would receive old, not up-to-date channel entries stuff. But this would output just fine:

{exp:channel:entries channel="appuntamenti" start_on="<?php echo $start_time; ?>" stop_before="<?php echo $stop_time; ?>" show_future_entries="yes" orderby="date" sort="asc"}
 {entry_date format="%H:%i"} - {title}
{/exp:channel:entries}

So I just took this output and file_get_contents’ed it into a custom PHP script.

I’d like to get to the bottom of this anyway, in case this pops up again.

       

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.