Guest User

Untitled

a guest
Jun 13th, 2013
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ob_start();
  2.  
  3.  
  4. //  %d
  5. $show_count = 10;
  6.  
  7. $query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || (  dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
  8.  
  9. $event_get = vB::$db->query_read($query);
  10.  
  11. $output_bits = '';
  12. while($event = vB::$db->fetch_array($event_get)) {
  13.  
  14.      if($event['dateline_to'] == 0 )
  15.      {
  16.          $format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
  17.      } else {
  18.          $format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
  19.      }
  20.      
  21.      $output_bits .= sprintf('
  22.        <div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
  23.            <p class="cms_widget_post_content">%s</p>
  24.        </div>
  25.        ',$event['eventid'],$event['title'],$format);
  26.  
  27. }
  28. $output = $output_bits;
  29.  
  30. ob_end_clean();
RAW Paste Data