Vis hvis der er noget på den givne dato.
Hey..Det var lidt svært at lave en passende overskrift, så håber jeg kan formulere spørgsmålet lidt bedre.
Jeg har følgene script:
<?
setlocale(LC_ALL,da_DK.ISO8859-1);
$Year = (isset($_REQUEST['Year']) && $_REQUEST['Year']) ? $_REQUEST['Year'] : strftime("%Y",time());
$Month = (isset($_REQUEST['Month']) && $_REQUEST['Month']) ? $_REQUEST['Month'] : strftime("%m",time());
$StartDate = "$Year-$Month-01";
$StartDateTS = strtotime($StartDate);
$StartDayNum = date("w",$StartDateTS);
$LastDay = date("j",strtotime("-1 day",strtotime("+1 month",$StartDateTS)));
$PreviousYear = strftime("%Y",strtotime("-1 month",$StartDateTS));
$PreviousMonth = strftime("%m",strtotime("-1 month",$StartDateTS));
$NextYear = strftime("%Y",strtotime("+1 month",$StartDateTS));
$NextMonth = strftime("%m",strtotime("+1 month",$StartDateTS));
echo("<table width=\"160\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class='caltext'>\n");
echo("<tr class='caltop'>\n");
echo("<td colspan=\"8\"><a href=\"".$_SERVER['SELF']."?Year=$PreviousYear&Month=$PreviousMonth\"><<</a> ".strftime("%B %Y",$StartDateTS)." <a href=\"".$_SERVER['SELF']."?Year=$NextYear&Month=$NextMonth\">>></a></td>\n");
echo("</tr>\n");
echo("<tr class='calday'>\n");
echo("<td width=\"20\" height=\"20\"> </td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">M</td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">T</td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">O</td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">T</td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">F</td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">L</td>\n");
echo("<td width=\"20\" style=\"border-bottom: 1px solid black\">S</td>\n");
echo("</tr>\n");
// LAV TOMME FELTER HVIS MÅNEDEN STARTER PÅ EN ANDEN DAG END MANDAG
if ($StartDayNum > 1) {
echo("<tr>\n");
echo("<td height=\"20\" style=\"border-right: 1px solid black; padding-right: 5px\" class='calday'> ".date("W",$StartDateTS)."</td>\n");
$EmptyCells = $StartDayNum - 1;
for ($I = 0; $I < $EmptyCells; $I++) {
echo("<td class='caldatetd'> </td>\n");
}
}
for ($Day = 1; $Day <= $LastDay; $Day++) {
if (date("w",strtotime("$Year-$Month-$Day")) == 1) {
echo("</tr>\n");
echo("<tr>\n");
echo("<td height=\"20\" style=\"border-right: 1px solid black; padding-right: 5px\" class='calday'>".date("W",strtotime("$Year-$Month-$Day"))."</td>\n");
}
$roundDay = round(date("d"));
if($Day == $roundDay) {
echo("<td><a href=\"index.php?site=cal&year=$Year&month=$Month&day=$Day\" class='caltoday'>$Day</a></td>\n");
} else {
echo("<td><a href=\"index.php?site=cal&year=$Year&month=$Month&day=$Day\" class='caldate'>$Day</a></td>\n");
}
}
echo("</tr>\n");
echo("</table>\n");
?>
Dette script viser en kalender. Jeg har ved siden af et notesystem, så man kan indsætte en note på en given dato.
Nu vil jeg gerne have at hvis der er en note der er sat med startdato skal datoen stå med fed i min kalender.
startdato er givet med et timestamp i databasen, der indeholder både dag, måned, år, timer, minutter og sekunder.
Håber i forstår mit spørgsmål..
