Welcome Guest, Not a member yet? Register   Sign In
Calendar Class: multiple events on one day
#3

[eluser]ehalber[/eluser]
Hi sophistry and thanks for your reply...I ended up solving the problem like this:

Code:
foreach ($events as $event)
            {
                if ( array_key_exists( $event->day, $calendar ) )
                {
                    $calendar[$event->day] = $calendar[$event->day] .'<br />'.
                    anchor(base_url() .'admin/calendar/'. $year .'/'. $month .'/'.
                    $event->id, $event->name);
                }
                else
                {
                    $calendar[$event->day] = anchor(base_url() .'admin/calendar/'.
                    $year .'/'. $month .'/'. $event->id, $event->name)   ;
                }
            }

This enables me to check whether or not an array key exists...if it does great, we'll just append some data to it, otherwise, just create a new entry.

In your post you mentioned nested arrays...

[quote author="sophistry" date="1202867826"]the code here:
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.
[/quote]

I'm not sure if that's what I did ( still a very new to the development stuff ), but would you mind elaborating a little. Thank you. Smile


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



Theme © iAndrew 2016 - Forum software by © MyBB