Poll

Helpful?

Yes
0 (0%)
No (Post why)
0 (0%)

Total Members Voted: 0

Voting closed: December 30, 2007, 01:27:33 AM

Author Topic: [Snippet] Simple Valid HTML Calendar  (Read 2200 times)

Acecool

  • Regular Member
  • **
  • Posts: 73
  • Karma: +0/-0
    • View Profile
    • PHP programmers forum
[Snippet] Simple Valid HTML Calendar
« on: December 04, 2007, 08:45:23 PM »
http://http://www.acecoolco.com/tutorials/28/simple-calendar-that-is-valid-html-4.01-transitional/page_1/tutorial_17.html

Copy and paste the code into a blank php file and enjoy :-)
    {
        $cal_weeks_days .= '</tr><tr>';
        $ii = 1;
    }

    // If the day is the current day, highlight it with a special color
    $extra = ($current_day == $day_i) ? 'background-color: ' . $row_highlight_color . ';': 'background-color: ' . $color . ';';

    // Show the days.
    $cal_weeks_days .= '<td valign="top"  style="' . $extra . ' height: 65px;">' . $day_i . '</td>';

    // Increment the day number and the week day number (ii)
    $day_i++;
    $ii++;
}

// Add end month spacers
if ((8 - $ii) >= 1)
{
    $cal_weeks_days .= '<td colspan="' . (8 - $ii) . '">&nbsp;</td>';
}

// Echo the VALID HTML
echo <<< HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
    <head>
        <title>Valid HTML Simple Calendar by Acecoolco</title>
        <style type="text/css">
        table,tr,td,th,tbody,TR,TD{
            font-family: Verdana;
            font-size: 8pt;
            font-size: 11; color: #000000;
            border-font-size: 11; color: #000000;
            border-collapse: collapse;
        }
        </style>
        </head>
    <body>
        <table border="1" cellpadding="1" cellspacing="1" width="$calendar_width">
            <tr>
                <td align="center" colspan="7" bgcolor="$row_head_color">$current_day_name the $current_day_S of $current_month_name, $current_year</td>
            </tr>
            <tr>
                $day_names
            </tr>
            <tr>
                $cal_weeks_days
            </tr>
        </table>
    </body>
</html>
HTML;
?>
[/php]