Jeg har fundet mig en overskuelig kalender som viser dage, måneder osv. Det jeg så vil er at integrere denne med følgende database:
CREATE TABLE `kalender` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`dag` TEXT NOT NULL,
`måned` TEXT NOT NULL,
`år` TEXT NOT NULL,
`event` TEXT NOT NULL
);
Hvis jeg så eksempelvis indsætter 1 i dag, 10 i måned, 2005 i år og en given beskrivelse i event så skulle den på kalender under dag 1 i måned 10(oktober) i år 2005 gøre denne til link og når man så trykker på denne skulle man så se eventet for den pågældene dag.
Min kalender ser således ud:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Calendar Test</title>
</head>
<body>
<?
// User callback function to show a day in the calendar
function mycal_show_month_day($year, $month, $day)
{
return($day);
}
/*
* bool mycal_show_month(string day_callback, int year, int month)
* Show a calendar in month view
* This function shows a calendar, it takes the following arguments:
* - string day_callback:
* The name of a user function which gets called for each day of the month.
* Can be used for example to show a day bold or plain depending whether events are stored for this day.
* The callback function must return the day as integer and take three arguments: int year, int month and int day.
* - int year:
* Year to show.
* - int month
* Month to show.
*/
function mycal_show_month($day_callback, $year = 0, $month = 0)
{
// set up default value for month (current month) if none was specified
if($month == 0)
{
$month = date( "m");
}
// setup default value for year (current year) if none was specified
if($year == 0)
{
$year = date( "Y");
}
$prev_month = date( "m", mktime(0, 0, 0, $month - 1, 1, $year));
$next_month = date( "m", mktime(0, 0, 0, $month + 1, 1, $year));
$prev_year = date( "Y", mktime(0, 0, 0, $month - 1, 1, $year));
$next_year = date( "Y", mktime(0, 0, 0, $month + 1, 1, $year));
?>
<style TYPE="text/css">
TD.Some
{
font-family :Tahoma, Verdana, Arial;
font-size :12px;
color :#000000;
font-weight :normal;
}
A
{
font-family :Tahoma, Verdana, Arial;
font-size :12px;
color :#000000;
font-weight :normal;
text-decoration: none;
}
</style>
<table align="CENTER" border="1" cellspacing="0" cellpadding="2" bgcolor="WHITE" bordercolor="Gray">
<tr>
<td>
<table width="140" border="0" cellpadding="1" cellspacing="0"
bgcolor="#FFFFFF">
<tr height="18" bgcolor="Silver">
<td width="20" height="18" align="RIGHT" valign="MIDDLE"> <a href=" <?
print(basename($PHP_SELF));
print( "?month=$prev_month");
print( "&year=$prev_year");
?>" class="noevent"><</a> </td>
<td width="120" colspan="5" align="CENTER" valign="MIDDLE" class="SOME">
<?
print(date( "F", mktime(0, 0, 0, $month, 1, $year)). " $year");
?> </td>
<td width="20" height="18" align="RIGHT" valign="MIDDLE"> <a href=" <?
print(basename($PHP_SELF));
print( "?month=$next_month");
print( "&year=$next_year");
?>" class="noevent">></a> </td>
</tr>
<tr>
<td align="RIGHT" class="SOME" width="20" height="15">S</td>
<td align="RIGHT" class="SOME" width="20" height="15">M</td>
<td align="RIGHT" class="SOME" width="20" height="15">T</td>
<td align="RIGHT" class="SOME" width="20" height="15">W</td>
<td align="RIGHT" class="SOME" width="20" height="15">T</td>
<td align="RIGHT" class="SOME" width="20" height="15">F</td>
<td align="RIGHT" class="SOME" width="20" height="15">S</td>
</tr>
<tr>
<td height="1" align="MIDDLE" colspan="7">
<hr size="1" noshade>
</td>
</tr>
<?
$day = 1 - date( "w", mktime(0, 0, 0, $month, 1, $year));
$days_in_month = date( "t", mktime(0, 0, 0, $month, 1, $year));
// Loop through all days in the month
while($day <= $days_in_month)
{
print( "<tr>");
// Print a row containing seven days
for ($j=1; $j<=7; $j++)
{
?>
<td align='right' width=20 height=15 valign='bottom' class='some'>
<?
print(($day <= $days_in_month && $day > 0) ? $day_callback($year, $month, $day): " ");
?>
</td>
<?
$day++;
}
print( "</tr>");
}
?>
</table>
</td>
</tr>
</table>
<?
return(true);
}
mycal_show_month( "mycal_show_month_day", $year, $month);
?>
</body>
</html>
Håber der er en person der kan hjælpe mig for er virkelig på bar bund, har siddet og kigger mange forummer igennem uden hjælp.. Er ked af jeg er nødsaget til at spørge, men hellere spørge end at gå og spekulere på det hele tiden