Php calendar-php Tutorial

Source: Internet
Author: User
Php calendar
 Year = date ('Y'); $ this-> month = date ('M'); $ this-> val = $ val; $ vars = get_class_vars (get_class ($ this); foreach ($ options as $ key => $ value) {if (array_key_exists ($ key, $ vars )) {$ this-> $ key = $ value ;}} function display () {$ value. ='
 
 
  
  
'; $ Value. = $ this-> showChangeDate (); $ value. = $ this-> showWeeks (); $ value. = $ this-> showDays ($ this-> year, $ this-> month); $ value. ='
 
 
'; Return $ value;} private function showWeeks () {$ value. =''; Foreach ($ this-> weeks as $ title) {$ value. =''. $ Title .'';} $ Value. =''; Return $ value;} private function showDays ($ year, $ month) {$ nowtime = mktime (0, 0, 0, $ month, 1, $ year ); // converted to seconds on the first day of the current month $ daysofmonth = date (t, $ nowtime); // The number of days of the current month $ weekofbeginday = date (w, $ nowtime ); // The first day of the month is the day of the week $ weekofendday = date (w, mktime (, 0, $ month +, $ year )); // the last day of the month is the day of the week $ daysofprevmonth = date (t, mktime (, 0, $ month, 0, $ year); // The number of days in the previous month $ count = 1; // count // list the days after the previous month for ($ I = 1; $ I <= $ weekofbeginday; $ I ++) {$ value. ="". ($ Daysofprevmonth-$ weekofbeginday + $ I ).""; $ Count ++;} // All for ($ I = 1; $ I <= $ daysofmonth; $ I ++) {$ css = ($ count % 7 = 0 | $ count % 7 = 1 )? "Weekday": "normalday"; if ($ I = $ today) $ css. = "today"; $ value. ="". $ I .""; If ($ count % 7 = 0) $ value. =""; $ Count ++;} // for ($ I = 1; $ I <= 6-$ weekofendday; $ I ++) {$ value. ="". $ I ."";} $ Value. =''; Return $ value;} private function showChangeDate () {$ url = basename ($ _ SERVER ['php _ SELF']); $ value =''; $ Value. ='PreYearUrl ($ this-> year, $ this-> month). '">'. 'last year '.''; $ Value. ='PreMonthUrl ($ this-> year, $ this-> month). '">'. 'last month '.''; $ Value. =''; $ Value. ='NextMonthUrl ($ this-> year, $ this-> month). '">'. 'next month '.''; $ Value. ='NextYearUrl ($ this-> year, $ this-> month). '">'. 'next year '.''; $ Value. =''; Return $ value;} private function preYearUrl ($ year, $ month) {$ year = ($ this-> year <= 1970 )? 1970: $ year-1; return 'Year = '. $ year. '& month = '. $ month;} private function nextYearUrl ($ year, $ month) {$ year = ($ year >= 2038 )? 2038: $ year + 1; return 'Year = '. $ year. '& month = '. $ month;} private function preMonthUrl ($ year, $ month) {if ($ month = 1) {$ month = 12; $ year = ($ year <= 1970 )? 1970: $ year-1;} else {$ month --;} return 'Year = '. $ year. '& month = '. $ month;} private function nextMonthUrl ($ year, $ month) {if ($ month = 12) {$ month = 1; $ year = ($ year> = 2038 )? 2038: $ year + 1;} else {$ month + +;} return 'Year = '. $ year.' & month = '. $ month ;}}

 $ Year, 'month' => $ month); if (isset ($ _ GET ['Year']) & isset ($ _ GET ['month']) {$ params = array ('year' = >$ _ GET ['Year'], 'month' = >$ _ GET ['month']); $ year = $ _ GET ['Year']; $ month = $ _ GET ['month'];} $ cal = new Calendar ($ params, $ list_sign ); echo $ cal-> display ();?>

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.