Php's perfect date calendar generation class we have written a php-generated date calendar generation class program.
Php tutorial perfect date calendar generation class
We wrote a date calendar generation class program generated using php.
Example:
Include_once '/class/calendar. class. php ';
$ Simple_example = new calendar ();
Print ($ simple_example-> output_calendar ());
*/
Class calendar {
Var $ date;
Var $ year;
Var $ month;
Var $ day;
Var $ week_start_on = false;
Var $ week_start = 7; // Sunday
Var $ link_days = true;
Var $ link_to;
Var $ formatted_link_to;
Var $ mark_today = true;
Var $ today_date_class = 'today ';
Var $ mark_selected = true;
Var $ selected_date_class = 'selected ';
Var $ mark_passed = true;
Var $ passed_date_class = 'passed ';
Var $ highlighted_dates;
Var $ default_highlighted_class = 'highghted ';
/* Constructor */
Function calendar ($ date = null, $ year = null, $ month = null ){
$ Self = htmlspecialchars ($ _ server ['php _ self ']);
$ This-> link_to = $ self;
If (is_null ($ year) | is_null ($ month )){
If (! Is_null ($ date )){
// -------- Strtotime the submitted date to ensure correct format
$ This-> date = date ("y-m-d", strtotime ($ date ));
} Else {
// -------------------------- No date submitted, use today's date
$ This-> date = date ("y-m-d ");
}
$ This-> set_date_parts_from_date ($ this-> date );
} Else {
$ This-> year = $ year;
$ This-> month = str_pad ($ month, 2, '0', str_pad_left );
}
}
Function set_date_parts_from_date ($ date ){
$ This-> year = date ("y", strtotime ($ date ));
$ This-> month = date ("m", strtotime ($ date ));
$ This-> day = date ("d", strtotime ($ date ));
}
1 2 3 4