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

Channel tag, using start_on not including an entry whose start time equals the start_on time

Development and Programming

octavianmh's avatar
octavianmh
69 posts
13 years ago
octavianmh's avatar octavianmh

This question may be related to a resolved thread.

Hey guys-

So I have a channel tag + php:

<?php
$ee =& get_instance();
$start_on = "";
if (isset($ee->uri->segments[3])) { 
   $start_on = $ee->uri->segments[3]."-"; 
   if (isset($ee->uri->segments[4])) { $start_on = $start_on.$ee->uri->segments[4]."-"; } else { $start_on = $start_on."01-"; }
   if (isset($ee->uri->segments[5])) { $start_on = $start_on.$ee->uri->segments[5]." "; } else { $start_on = $start_on."01 "; }
}
$start_on = $start_on." 12:00 AM";
if ($start_on == " 00:00") { $start_on = $ee->localize->decode_date('%Y-%m-%d %H:%i', $ee->localize->now); }
// echo $start_on;
?>
{exp:channel:entries channel="event" dynamic="no" show_future_entries="yes" start_on="<?php echo $start_on; ?>" disable="member_data|pagination|trackbacks" orderby="event_start_date" sort="asc"}
etc...

So this is working GREAT except for one event, that happens to start ON August 1 at 12:00 AM (using the event helper extension to set start dates to 12:00 AM). $start_on is correctly outputting “2012-08-01 12:00 AM”, which should include that august 1 entry….

Any reason why that entry would be excluded? It’s shown when I go back to July!

       
octavianmh's avatar
octavianmh
69 posts
13 years ago
octavianmh's avatar octavianmh

Bump. No ideas?

       
octavianmh's avatar
octavianmh
69 posts
13 years ago
octavianmh's avatar octavianmh

Well, I fixed it, but it’s really ugly — thinking through a better way to fix this issue, if anyone knows the “right” way to fix this, i’m all ears!

<?php
$ee =& get_instance();
$start_on = "";
if (isset($ee->uri->segments[3])) { 
   $start_on = $ee->uri->segments[3]."-"; 
   if (isset($ee->uri->segments[4])) { $start_on = $start_on.$ee->uri->segments[4]."-"; } else { $start_on = $start_on."01-"; }
   if (isset($ee->uri->segments[5])) { $start_on = $start_on.$ee->uri->segments[5]." "; } else { $start_on = $start_on."01 "; }
}
$start_on = $start_on." 12:00 AM";
if ($start_on == " 00:00") { $start_on = $ee->localize->decode_date('%Y-%m-%d %H:%i', $ee->localize->now); } else {
 $start_on_unix_bug = $ee->localize->convert_human_date_to_gmt($start_on) - 1000;
 $start_on = $ee->localize->decode_date('%Y-%m-%d %H:%i', $start_on_unix_bug);
}
?>
{exp:channel:entries channel="event" dynamic="no" show_expired="yes" show_future_entries="yes" start_on="<?php echo $start_on; ?>" disable="member_data|pagination|trackbacks" orderby="event_start_date" sort="asc"}
{if no_results}
etc...
       

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.