PHPBuilder - Easy Calendar Applications Page 3

RSS Twitter

Easy Calendar Applications - Page 3

by: Mark Musone
July 30, 2000

The other function we will use is:
<?php mcal_days_in_month($month,$leap_year); ?>
This simply returns the number of days in a given month, taking into account if it is a leap year or not.
To find out what day of the week the first of the month is, because we need to display the first on the correct weekday when we go to display the calendar, we use:
<?php $startday=mcal_day_of_week($year,$month,1); ?>
The next function is where the majority of the work is done:
<?php $events=mcal_list_events($stream,$year,$month,1,$year,$month,$days); ?>
This function takes in a stream, and beginning and end dates. It returns a list of event ID's for every event that is scheduled between the two dates.
Once we have this list of ID's, we need to loop through the events and find their actual dates. while we are at it, we might as well store the title of the events since we will be printing them out in the month view also:


for($x=0$x<count($events); $x++) {
$date_array[$start->mday]=$date_array[$start->mday] . "<br>$event->title";

Now that we have all the date and event information, the rest is simple. We just loop through all the dates, printing out the information we need.

« Previous Page
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Mark Musone



(Maximum characters: 1200). You have characters left.