WebsiteBaker 2.13.9 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
[[Events-list?section_id=8&dateend=2080-07-13&max=10]]
Can this be done?
I have a time counter for the upcoming event and need to bring only the date and hour from the first upcoming event
Hi,Quote from: Roych on April 17, 2016, 03:09:55 PMCan this be done?Surely, the events are processed in a loop. Just use a counter to jump over the processing for the first events. There are a lot of verions of this droplet out there and most of them are even custom patched. So if you want a more detailed answer you can post your droplet here.QuoteI have a time counter for the upcoming event and need to bring only the date and hour from the first upcoming event Same answer, just use a counter to identify the first event.regards
// if (PAGE_ID != 3) { //:Show next #N events//:// Get_Concertsglobal $database, $wb;setlocale (LC_ALL, 'sl_SI.UTF-8'); //za vse kategorije setlocale (LC_TIME, 'sl_SI.UTF-8'); //za datumske funkcije// Show how many items, defaults to 10?if ( !isset($max) ){ $max = 10; };// year and month and section defaultsif(!isset($year)) {$year = date('Y', time()); }if(!isset($month)) {$month = date('n', time()); }if(!isset($section_id)) {$section_id = 0 ; }// Set dateformat to suit your needs, add timeformat if needed$dateformat = 'd'; // Standard php date formats$datemonth = 'M'; // Standard php date formats$dateyear = 'Y'; // Standard php date formats// Fetch base page link, if event_id = set$extrasql = '';$page_id = 0;$page_link ='';if ($section_id<>0) { $extrasql = " section_id = '".$section_id."' AND "; $sql = "SELECT page_id FROM ".TABLE_PREFIX."sections WHERE section_id = '".$section_id."'";$result = $database->query($sql);if ( $result->numRows() > 0 ) {while( $row = $result->fetchRow() ) {$page_id = $row['page_id'];}}if ($page_id <> 0) {$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".$page_id."'";$result = $database->query($sql);if ( $result->numRows() > 0 ) {while( $row = $result->fetchRow() ) {$page_link = page_link($row['link']);}}}}// Set start- and end date for query// $datestart = "$year-$month-1"; ORIGINAL = show all events in this month$datestart = date("Y-m-d"); // ALTERNATIVE = show all events in this month, starting today$dateend = "$year-$month-".cal_days_in_month(CAL_GREGORIAN, $month,$year);// Fetch the items$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";$mod_query = $database->query($sql);while ( $row =& $mod_query->fetchRow()){// Build url like : pages/kalendar.php?id=2&detail=1 $page_url = $page_link.'?id='.$row['id'].'&detail=1';$ds = $row['date_start']." ".substr($row['time_start'],0,5);$de = $row['date_end']." ".substr($row['time_end'],0,5);$datetime_start = mktime(substr($ds,11,2),substr($ds,14,2),0,substr($ds,5,2),substr($ds,8,2),substr($ds,0,4));$datetime_end = mktime(substr($de,11,2),substr($de,14,2),0,substr($de,5,2),substr($de,8,2),substr($de,0,4)); $printTime = $row['time_start']; $mod_list.= ' <ul> <li class="item event-item"> <div class="event-date"> <span class="date">'.date($dateformat,$datetime_start).'</span> <span class="month">'.date($datemonth,$datetime_start).'</span> <span class="leto">'.date($dateyear,$datetime_start).'</span> <>'; if(date('Y-m-d',$datetime_start)==date('Y-m-d')){ $mod_list.= '<div class="event-detail"> <h4><a href="'.$page_url.'">'.$row["name"].'</a></h4> <span class="event-dayntime meta-data"> Začetek ob: '.substr($printTime,0,5).' uri. | <span class="danes" style="color:red"> Today!</span> </span><> <div class="to-event-url"> <div><a href="'.$page_url.'" class="btn btn-default btn-sm">Podrobnosti</a><> <> </li></ul> '; } else{ $mod_list.= '<div class="event-detail"> <h4><a href="'.$page_url.'">'.$row["name"].'</a></h4> <span class="event-dayntime meta-data"> Začetek ob: '.substr($printTime,0,5).' uri. </span> <> <div class="to-event-url"> <div><a href="'.$page_url.'" class="btn btn-default btn-sm">Podrobnosti</a><> <> </li></ul> '; } } return $mod_list;// }
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 3, ".$max." ";
You can change the sql query to get number 4 to 14 (if $max=10)Change this lineCode: [Select]$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_act ions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";into Code: [Select]$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_act ions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 3, ".$max." ";note the end of the line: "... LIMIT 3, ...."
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_act ions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_act ions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 3, ".$max." ";
// if (PAGE_ID != 3) { //:Show next #N events//:// Get_Concertsglobal $database, $wb;setlocale (LC_ALL, 'sl_SI.UTF-8'); //za vse kategorije setlocale (LC_TIME, 'sl_SI.UTF-8'); //za datumske funkcije// Show how many items, defaults to 10?if ( !isset($max) ){ $max = 10; };// year and month and section defaultsif(!isset($year)) {$year = date('Y', time()); }if(!isset($month)) {$month = date('m', time()); }if(!isset($section_id)) {$section_id = 0 ; }// Set dateformat to suit your needs, add timeformat if needed$dateformat = 'd'; // Standard php date formats$datemonth = 'M'; // Standard php date formats$dateyear = 'Y'; // Standard php date formats// Fetch base page link, if event_id = set$extrasql = '';$page_id = 0;$page_link ='';if ($section_id<>0) { $extrasql = " section_id = '".$section_id."' AND "; $sql = "SELECT page_id FROM ".TABLE_PREFIX."sections WHERE section_id = '".$section_id."'";$result = $database->query($sql);if ( $result->numRows() > 0 ) {while( $row = $result->fetchRow() ) {$page_id = $row['page_id'];}}if ($page_id <> 0) {$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".$page_id."'";$result = $database->query($sql);if ( $result->numRows() > 0 ) {while( $row = $result->fetchRow() ) {$page_link = page_link($row['link']);}}}}// Set start- and end date for query// $datestart = "$year-$month-1"; ORIGINAL = show all events in this month$datestart = date("Y-m-d"); // ALTERNATIVE = show all events in this month, starting today$dateend = "$year-$month-".cal_days_in_month(CAL_GREGORIAN, $month,$year);// Fetch the items$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";$mod_query = $database->query($sql);while ( $row =& $mod_query->fetchRow()){// Build url like : pages/kalendar.php?id=2&detail=1 $page_url = $page_link.'?id='.$row['id'].'&detail=1';$ds = $row['date_start']." ".substr($row['time_start'],0,5);$de = $row['date_end']." ".substr($row['time_end'],0,5);$datetime_start = mktime(substr($ds,11,2),substr($ds,14,2),0,substr($ds,5,2),substr($ds,8,2),substr($ds,0,4));$datetime_end = mktime(substr($de,11,2),substr($de,14,2),0,substr($de,5,2),substr($de,8,2),substr($de,0,4)); $printTime = $row['time_start']; $mod_list.= ' <div class="notice-bar"> <div class="container"> <div class="row"> <div class="col-md-3 col-sm-6 col-xs-6 notice-bar-title"> <span class="notice-bar-title-icon hidden-xs"><i class="fa fa-calendar fa-3x"></i></span> <span class="title-note">Next</span> <strong>Upcoming event</strong> <> <div class="col-md-3 col-sm-6 col-xs-6 notice-bar-event-title"> <h5><a href="single-event.html">'.$row["name"].'</a></h5> <span class="meta-data">'.date($dateformat,$datetime_start).' '.date($datemonth,$datetime_start).', '.date($dateyear,$datetime_start).'</span> <> <div id="counter" class="col-md-4 col-sm-6 col-xs-12 counter" data-date="'.date($datemonth,$datetime_start).' '.date($dateformat,$datetime_start).', '.date($dateyear,$datetime_start).', '.substr($printTime,0,5).'"> <div class="timer-col"> <span id="days"></span> <span class="timer-type">days</span> <> <div class="timer-col"> <span id="hours"></span> <span class="timer-type">hrs</span> <> <div class="timer-col"> <span id="minutes"></span> <span class="timer-type">mins</span> <> <div class="timer-col"> <span id="seconds"></span> <span class="timer-type">secs</span> <> <> <div class="col-md-2 col-sm-6 hidden-xs"> <a href="events.html" class="btn btn-primary btn-lg btn-block">All Events</a> <> <> <> <>';} return $mod_list;// }