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?
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.
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.
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.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.