|
|
|
<html>
<head>
<title>Rocket Organizer</title>
<link rel=stylesheet type="text/css" href="./styles/styles.css">
</head>
<body bgcolor="#FFFFE0">
<?php
$j = $j ? $j : date("Y",time());
$m = $m ? $m : date("n",time());
$d = $d ? $d : date("j",time());
$intDATE=(mktime(0,0,0,$m,$d,$j));
$upM=mktime(0,0,0,($m+1),1,$j);
$doM=mktime(0,0,0,($m-1),1,$j);
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);
}
for ($i=1;$i<=42;$i++) {
$marray[$i]=mktime(0,0,0,date("n",$startDAY),date("j",$startDAY)+$i,date
("Y",$startDAY));
}
return $marray;
}
$mARRAY=get_mARRAY();
?>
<table border="0">
<tr>
<td align="left">
<?php
echo '<a href="calnav.php?j=' . date
("Y",$doM) . '&m=' . date("n",$doM) . '&d=' . date("j",$doM) . '" target="navframe">';
echo '<img src="./images/mondo.gif" border=0>';
echo '</a>';
?>
</td>
<td colspan="5">
<p align="center"><font size="1"
face="Verdana" color="#000080">
<?php
echo date("F",$intDATE) . " " . date("Y",$intDATE);
?></font></p>
</td>
<td align="right">
<?php
echo '<a href="calnav.php?j=' . date("Y",$upM) . '&m=' . date
("n",$upM) . '&d=' . date("j",$upM) . '" target="navframe">';
echo '<img src="./images/monup.gif" border=0>';
echo '</a>';
?>
</font> </td>
</tr>
<tr>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
M
</font></td>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
T
</font></td>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
W
</font></td>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
T
</font></td>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
F
</font></td>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
S
</font></td>
<td width=17 height=17 align="center" bgcolor="#000080">
<font color="#FFFFFF">
S
</font></td>
</tr>
<?php
$countDAYS=1;
for ($w=1;$w<=6;$w++) {
echo '<tr>';
for ($d=1;$d<=7;$d++) {
echo '<td height=15 align="center">';
if (((date("j",$mARRAY[$countDAYS])>7) & ($w==1)) | ((date
("j",$mARRAY[$countDAYS])<=14) & ($w>=5))) {
echo '<a href="calnav.php?j=' . date("Y",$mARRAY[$countDAYS]) . '&m=' .
date("n",$mARRAY[$countDAYS]) . '&d=' . date("j",$mARRAY[$countDAYS]) . '"
target="navframe" style="color:C0C0C0">';
echo date("j",$mARRAY[$countDAYS]);
echo '</a>';
} else {
if ($mARRAY[$countDAYS]==$intDATE) {
echo '<strong>';
}
echo '<a href="calnav.php?j=' . date("Y",$mARRAY[$countDAYS]) . '&m=' .
date("n",$mARRAY[$countDAYS]) . '&d=' . date("j",$mARRAY[$countDAYS]) . '"
target="navframe">';
echo date("j",$mARRAY[$countDAYS]);
echo '</a>';
if ($mARRAY[$countDAYS]==$intDATE) {
echo '</strong>';
}
}
echo '</td>';
$countDAYS=++$countDAYS;
}
echo '</tr>';
}
?>
</table>
</body>
</html>
|
|
| Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time. Categories : PHP, Calendar, Date Time, HTML and PHP | | | Simple PHP control CSS Calender Categories : PHP, HTML and PHP, Calendar, Date Time, CSS | | | Customizable Calendar Class Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | Dynamic Calender in PHP, Javascript and HTML. Categories : PHP, Java Script, HTML and PHP, Calendar | | | pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes | | | A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed. Categories : Date Time, PHP, Complete Programs, Calendar | | | Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used. Categories : HTML and PHP, PHP, Date Time | | | If you want to create select buttons featuring current date this example will show you how... Categories : Date Time, HTML and PHP, PHP | | | Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example. Categories : PHP, Date Time, PHP Classes, Calendar | | | Monthly and Daily Upcoming Events calendar. Categories : Date Time, PostgreSQL, PHP, Calendar, Databases | | | php html calender dynamic Categories : HTML and PHP, PHP, Calendar | | | A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function. Categories : PHP, PHP Classes, Calendar, Date Time | | | Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June). Categories : Calendar, Date Time, PHP | |
| | | | 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....
i hope, this helps.
gernot
| |
|
|
|