Home

Dynamic Classes in PHP?


I’m toying around with implementing the experimental idea of dynamically extending my calendar class with fields pertaining to a specific type of event.

For example, I need to use this class to provide support for the short courses offered by CERIAS training and awareness. This application needs a large set of custom fields to be bound to the events.

Rather than hard-code in support for their fields (which would require altering the table structure of the events table and adding a ton of functions to the events class and XtremeCalendar (helper functions) classes for full support.

A more attractive solution would to allow an application developer to create a seperate db table with a set of custom fields and a field linking it to an event_id. The developer would then use this function to point to that table and subsequently populate the class with the necessary variables, validation methods, and utility functions.

These methods and variables would then be available in the same fashion as the default methods and functions.