Jump to content

Help with Calendar


Mundo

Recommended Posts

<?
mysql_connect("localhost","root","");
mysql_select_db("clicker");

include "tpl/header.tpl";
include "tpl/navigation_calendar.tpl";

$date = time();
$day = date("d", $date);
$month = date("m", $date);
$year = date("y", $date);
$first_day = mktime(0, 0, 0, $month, 1, $year);
$day_of_week = date('D', $first_day) ; 
$title = date('F', $first_day);

switch($day_of_week){
case "Mon": $blank = 0; break;
case "Tue": $blank = 1; break;
case "Wed": $blank = 2; break;
case "Thu": $blank = 3; break;
case "Fri": $blank = 4; break;
case "Sat": $blank = 5; break;
case "Sun": $blank = 6; break;
}

$days_in_month = cal_days_in_month(0, $month, $year); 

echo "<div id=\"text\"><table border=\"1\">";
echo "<tr><td colspan=\"7\"> $title $year </td></th></tr>";
echo "<tr><td width=\"42\"><b>Mon</b></td><td width=\"42\"><b>Tues</b></td><td width=\"42\"><b>Weds</b></td><td width=\"42\"><b>Thurs</b></td><td width=\"42\"><b>Fri</b></td><td width=\"42\"><b>Sat</b></td><td width=\"42\"><b>Sun</b></td></tr>";

$day_count = 1;
echo "<tr>";

while ($blank > 0) {
echo "<td></td>";
$blank = $blank-1;
$day_count++;
} 

$day_num = 1;

while ( $day_num <= $days_in_month ) {
echo "<td> $day_num </td>";
$day_num++;
$day_count++;
if ($day_count > 7) {
	echo "</tr><tr>";
	$day_count = 1;
	}
} 

while ( $day_count >1 && $day_count <=7 ) {
echo "<td> </td>";
$day_count++;
}

echo "</tr></table>"; 

include "tpl/sidebar.tpl";
include "tpl/footer.tpl";
?>

 

I followed a tutorial and have got this so far. How can I make the CURRENT DAY cell with a thick outline?

Link to comment
https://forums.phpfreaks.com/topic/150606-help-with-calendar/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.