TT calendar library returnmonthhtml
returnmonthhtml -- Returns an HTML table from a month array.

Description

string returnmonthhtml(array month_array[,string topcolour[,string tableattributes]])

Returns an HTML interpretation of a month supplied as a month array with the days of that month either linked to URIs or in coloured cells, and the columns of the table headed by day names as specified in the month array. For details of the array format see the about the month arrays used by this library page.

month_array is an array representing the display format of a given month. For details of the array format see the about the month arrays used by this library page.

topcolour is an optional HTML colour, either as a hexadecimal string such as "#0000ff" or a text string such as "blue" representing the background colour of the table cells containing the day names at the tops of the table columns. For more information on valid colour names see the This W3C page.

tableattributes is an optional string representing any attributes you might wish to give the resulting HTML table. By default this function produces a simple <table> tag, if you wanted to put any attributes in that tag you might specify them here. For example cellspacing="1" cellpadding="1".

Examples

The code below draws a calendar for March 2004.
include("ttcalendar.php");

$our_month = 3; #march
$our_year = 2004;
$month_array = returnmontharray($our_month,$our_year);

echo returnmonthhtml($month_array);

Here is the HTML returned:
SMTWTFS
123456
78910111213
14151617181920
21222324252627
28293031

The code below draws a calendar for March 2004 with the day names bar coloured yellow.
include("ttcalendar.php");

$our_month = 3; #march
$our_year = 2004;
$month_array = returnmontharray($our_month,$our_year);

echo returnmonthhtml($month_array,"#ffff00");

Here is the HTML returned:
SMTWTFS
123456
78910111213
14151617181920
21222324252627
28293031

And here's the same code, this time with some table attributes.
include("ttcalendar.php");

$our_month = 3; #march
$our_year = 2004;
$month_array = returnmontharray($our_month,$our_year);

echo returnmonthhtml($month_array,"#ffff00","border=\"1\" cellpadding=\"3\" cellspacing=\"3\"");

Here is the HTML returned:
SMTWTFS
123456
78910111213
14151617181920
21222324252627
28293031

dayrangelink Contents About the demo