O'Reilly logo

PHP 5 Social Networking by Michael Peacock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calendar library

We will save our calendar library file as /lib/calendar/calendar.class.php. The first thing for us to do in our file, is create a number of variables, and the constructor.

We need variables for:

  • The year the calendar represents
  • The day the calendar represents
  • The month the calendar represents
  • The day of the week we want our calendar to start with
  • Days of the week, ordered so we can change them using our start day of the week as an offset
  • Days of the week ordered with respect to our offset
  • The name of the month represented by the calendar
  • Dates of the month
  • Styles associated with each of the days of the month
  • Data associated with each of the days of the month, that is, the events on those days
    <?php /** * Calendar object */ class Calendar{ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required