Php perfect date calendar generation class (1/4)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.