function get_mARRAY() {
global $intDATE;
global $d;
global $m;
global $j;
if (date("w",mktime(0,0,0,$m,1,$j))==2) { //if 1st of requested month is a monday -
start with first
$startDAY=mktime(0,0,0,$m,1,$j);
} else { //if not then we look for the last monday of
the previous month
$startDAY=mktime(0,0,0,$m,0-date("w",mktime(0,0,0,$m,1-1,$j)),$j);
}
uhhh uhhh wrote :575
for each of the scripts posted you should have an active link to a site which is using that script!
just a thought
chris<pixelmonkey>
Gernot Brandl wrote :576
sorry, but this script runs only on a lan-server and is not accessable through the internet.
gernot
Wayne Harris wrote :588
I was able to integrate this clever little calendar with MySQL with these modifications . . .
Code posted here was beginning some months with the date "2", at least on my host`s Linux/Apache/PHP4 server. Was able to change Brandl`s get_mARRAY() function to get the arrays always to start with "1" (with the first day in the weekrow being Sunday rather than Monday, as is common) by changing the function get_mARRAY() as follows:
function get_mARRAY() {
global $intDATE;
global $d;
global $m;
global $j;
if (date("w",mktime(0,0,0,$m,1,$j))==1) {
$startDAY=mktime(0,0,0,$m,1,$j);
} elseif (date("w",mktime(0,0,0,$m,1,$j))==2) {
$startDAY=mktime(0,0,0,$m,0,$j);
} elseif (date("w",mktime(0,0,0,$m,1,$j))==3) {
$startDAY=mktime(0,0,0,$m,-1,$j);
} elseif (date("w",mktime(0,0,0,$m,1,$j))==4) {
$startDAY=mktime(0,0,0,$m,-2,$j);
} elseif (date("w",mktime(0,0,0,$m,1,$j))==5) {
$startDAY=mktime(0,0,0,$m,-3,$j);
} elseif (date("w",mktime(0,0,0,$m,1,$j))==6) {
$startDAY=mktime(0,0,0,$m,-4,$j);
} else {
$startDAY=mktime(0,0,0,$m,-5,$j);
}
for ($i=1;$i<=42;$i++) {
$marray[$i]=mktime(0,0,0,date("n",$startDAY),date("j",$startDAY)-2+$i,date
("Y",$startDAY));
}
return $marray;
}
Spelling out the value for each day is a lot clunkier than Brandl`s code but it worked for me.:) But what finally made it all work was inserting that "-2" in ""j",$startDAY)-2+$i" in the for loop.
You can also change "target=_blank" to "target=_self" in the html anchor if you don`t want to open a new window.
The way this little calendar creates numerical year, month and day values (e.g., href=calnav.php?j=2001&m=5&d=1) makes it very easy to assemble a date variable and launch a MySQL query.
Thanks, Brandl.
Gernot Brandl wrote :589
the problem here is:
here in europe, we start each week with monday. some systems report the sunday as weekday 1 (i think, thats`s the american system) of the week. i`m not sure if it`s the php function date() that is responsible for this. if your system reports the monday as day 1 of a week, just change the folloeing line from:
if (date("w",mktime(0,0,0,$m,1,$j))==2) { //if 1st of reque....
to
if (date("w",mktime(0,0,0,$m,1,$j))==1) { //if 1st of reque....