Populating a calendar with PHP foreach code

前端 未结 1 1929
南笙
南笙 2021-01-27 20:59

I am using the following jQuery calendar: https://github.com/MrHus/jquery-monthly-ical/tree/

Following the documentation, it tells me that dates should be entered like

相关标签:
1条回答
  • 2021-01-27 21:25

    This should do it:

    $dates = array();
    
    // build an array with that data
    foreach($events as $event)
      $dates[] = (object)array(
         'date'  => date('Y/m/d'),
         'title' => $event->title,
         'desc'  => sprintf('<a href="%s/index.php/events/get_event?id=%s">Details/Signups</a>', SITE_URL, $event->id),
      );
    
    ?>
    
    eventdates:
    
    <?php print json_encode($dates); // print it as a json string ?>
    
    0 讨论(0)
提交回复
热议问题