No, the above code is fine - I've narrowed the problem down to a couple of other snippets;
PHP Code:
$month[10] = "october";
$month[11] = "november";
$month[12] = "december";
$month[1] = "january";
$month[2] = "february";
$month[3] = "march";
$month[4] = "april";
// get current month to increase, was originally date('n') but I set it to 10 to try to force it
$start = 10;
// get current year
$year = date('Y');
//create enclosing div
echo '<div class="calendarwrap">';
// create loop to run 7 times displaying the calendars
for ($i = 0; $i <=6; $i+=1) :
// check if its the next year or not
if ($start == 13) {
// increase the year if its next year
$year ++;
$start = 1;
}
and
PHP Code:
function createmonth($month, $year, $theactualmonth) {
include("config.php");
$month_to_check = strtolower(date("F", mktime(12, 0, 0, $month, 1, $year)));
$state = $default_tariffs[$month_to_check];
$date = mktime(12, 0, 0, $month, 1, $year);
$daysInMonth = date("t", $date);
// calculate the position of the first day in the calendar (sunday = 1st column, etc)
$offset = date("w", $date);
$rows = 1;
for($i = 1; $i <= $offset; $i++)
I can sort of see what it's doing, but it's like having a basic knowledge of French, and trying to translate a Greek text using only a French-Greek dictionary!
Problem is, the calendar was originally designed for accommodation providers to show availability all year round, and I tried to modify it to only do October-May for a fishing guide client.
Is $month in createmonth() and mktime() the array defined in the first snippet? And if so, why isn't it simply reading "October, November" etc instead of insisting on returning "January, February" etc??