PHP Calendar Script Tutorial




Here’s a PHP calendar script and tutorial. I took some approached I’d seen from other developers and turned them into a class… and cleaned them up a bit.

Original source


13 responses to “PHP Calendar Script Tutorial”

  1. hy john !
    why it says Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:xampphtdocsDASHindex.php on line 13.. confused!!!

  2. Hello John, nice work! Thank you for your great work and dedication, keep on this path! I want to add something about OOP, when you are working with methods ( and functions in general ) try as much as possible to not output HTML code from them.If you want to change the HTML structure of the calendar, you have to do it inside the class, each and every time, this could easily bring tons of problems.

    Try building this class in a way that will return your required data ( you can even make it return json code for working with javascript, your class becomes so flexible ), then, you can use the data as you want.

  3. // Days of the week header
    foreach ( $this->days_of_week as $day ) {
    $output .= '<th class="header">' . $day . '</th>';
    }
    the website is pushing out an error on the foreach statement and i cant figure out what i did wrong. btw it's line 30

Leave a Reply