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

Displaying a calendar

With our calendar library in place, we now need to look at how a controller would leverage the power of the library to generate a particular month, and display it to the user.

Generate and output

To actually display a calendar, we need some code which:

  • Requires the calendar library
  • Instantiates the object
  • Generates the month
  • Sends various bits of data to the template
  • Outputs the template

We also need a template file with our 42 boxes in a calendar grid.

The following code can be used to generate a calendar (this isn't for a specific feature, you can find the code in the testOutput() method in the calendar controller):

// require the class require_once( FRAMEWORK_PATH . 'lib/calendar/calendar.class.php' ); // set the default month ...

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