TT calendar library dayrangelink
dayrangelink -- Applies an HTML link tag to a range of days in a month array.

Description

array dayrangelink(array month_array,string link, int start[,int end])

Returns an array representing the display format of a given month with the "link" attribute for each of the range of days specified by start and end set to the string specified in link. The array format returned is detailed in 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.

link is a text string representing the relative or absolute URI to which the date or dates should be linked. For example "index.php" or "http://www.technotoad.com/build.php". When the array is rendered into HTML by dayrangelink, each day in the calendar between the dates specified by start and end is linked to this value, with 3 added variables, year, month and day, represending the year, month and day of the calendar day in question. For example the 11th of March 2004 would be linked to "index.php" as follows: "index.php?year=2004&month=3&day=11". Any further variables can be passed in this parameter simply by including them in the URI, for example "index.php?venue=7&band=5".

start is the first date you wish to be set to the link specified by link.

end is an optional parameter representing the last date you wish to be set to the link specified by link. If this parameter is set, all the days between start and end inclusive have their "link" attribute set to link. If it is not set, only the day specified by start is linked.

Examples

The code below links the 7th to the 15th of the month to "index.php".
include("ttcalendar.php");

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

$month_array = dayrangelink($month_array,"index.php",7,15); 

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

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

daycolour Contents returnmonthhtml