• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calendar Class: multiple events on one day

#2
[eluser]sophistry[/eluser]
the code here:

Code:
$calendar[date('d', strtotime($event->date))] = $event->name;

will only have *one* event per array index because the index is the day number. so, if you have two events on day 1 of the month the foreach will write over the first one with the second.

if you don't want to modify the current code you have (which i'd suggest you do if you want multiple events per day), just use a nested array for the events.

it isn't clear whether you want to use the CI calendar class for this, but it seems like you might be because why else would you be preparing an array with day numbers as keys; that is one of the essential flaws of the current CI calendar class.


Messages In This Thread
Calendar Class: multiple events on one day - by El Forum - 02-12-2008, 11:16 AM
Calendar Class: multiple events on one day - by El Forum - 02-12-2008, 01:57 PM
Calendar Class: multiple events on one day - by El Forum - 02-12-2008, 03:14 PM
Calendar Class: multiple events on one day - by El Forum - 02-12-2008, 04:36 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.