Next club night widget on the home page

Darren

Core Member
Just a quick note that if the next club night it today, it shows the next club night as being in 2 weeks time :)
 
Okey dokey, thanks for the info. I'll take a look.

This is the code for it.
ob_start();



// %d
$show_count = 4;


$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '%d' || ( dateline_from >= '%d' AND dateline_to < '%d' )) AND title = 'Renegades Club Night' ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);


$event_get = vB::$db->query_read($query);


$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {


if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a rel="nofollow" href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);


}
$output = $output_bits;




ob_end_clean();
 
Last edited:
They like using sprintf a lot :noidea:

I'm guessing the date stored in the database for the dateline_from and dateline_to are correct, so any chance of adding an

echo "Test".TIMENOW."<br />";

between the $query = .... and $event_get = .... lines. Just interested in seeing what time it thinks now is. All things being correct, all the times should be set to UTC, so the functions should work fine and it would only be an hour out when we're in BST.

Also, any chance of running the sql directly in the database and putting up what it returns (along with the sql statement to compare the times).
 
Back
Top