PHP Perfect Date Calendar generation Class (_php) tutorial

Source: Internet
Author: User
PHP Perfect Date Calendar Generation class we wrote a date calendar generated in PHP to generate a class program OH.

PHP Tutorial Perfect Date Calendar Generation class
We wrote a date calendar generated using PHP to generate the class program OH.
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 = ' highlighted ';


/* 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

http://www.bkjia.com/PHPjc/444876.html www.bkjia.com true http://www.bkjia.com/PHPjc/444876.html techarticle PHP Perfect Date calendar Generation class we wrote a date calendar generated in PHP to generate a class program OH. PHP Tutorial Perfect Date Calendar Generation class We wrote a date that was generated in PHP ...

  • 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.