TT calendar library daycolour
daycolour -- Sets all instances of a given weekday in a month array to a specified colour.

Description

array daycolour(array month_array, int daytocolour, string colour)

Returns an array representing the display format of a given month with the "col" attribute for each instance of the weekday specified by daytocolour set to the string specified in colour. 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.

daytocolour is an integer representing the weekday to which to apply the colour specified by colour. This follows the same convention used by PHP's getdate() function, where 0 represents sunday, 1 represents monday and so on until 6, representing saturday.

colour is an HTML colour, either as a hexadecimal string such as "#0000ff" or a text string such as "blue". For more information on valid colour names see the This W3C page.

Example

The code below colours saturdays and sundays light grey.
include("ttcalendar.php");

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

$month_array = daycolour($month_array,0,"#dddddd"); #Colour the sundays grey
$month_array = daycolour($month_array,6,"#dddddd"); #Colour the saturdays grey

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

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

dayrangecolour Contents dayrangelink