FullCalendar limit number of events and have a MORE link

前端 未结 5 1680
暗喜
暗喜 2020-12-19 17:33

I have seen that there has been a request to add a MORE link, to the calendar and limit the number of events. Is this done yet? Or has anyone implemented there own work arou

5条回答
  •  不思量自难忘°
    2020-12-19 17:48

    If anyone else having the same problem read this:

    if PHP/MySQL is used to fetch events from DB:

    just get start date stamp and end date stamp of month.

    then use simple for loop

      $allEvents = array();
      for ($i = $start; $i <= $end; $i = strtotime("+ 1 day", $i)) {
         //need to have start and end dates to be the same day but end day must be at 23:59:59
         $newStart = $i;
         $newEnd = strtotime("+ 23 hours 59 minutes 59 seconds", $newStart);
         $limit = 10;
         //load all events with limit whatever limit you wish and merge with all events
         $loadedEvents = loadEvents($newStart, $newEnd, $limit, $otheroptions);
         $allEvents = array_merge($allEvents, $loadedEvents);
      }
    

    and then you can use $allEvents array to display events. It worked for me and each day displays 10 events at max.

提交回复
热议问题