note 43709 added to ref.calendar
| From: | dindinha_debs at hotmail dot com | Date: | Wed, 30 Jun 2004 23:28:07 +0000 |
| Subject: | note 43709 added to ref.calendar | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72203@lists.php.net to get a copy of this message | ||
I see the calendar, and think that is beatifull , but isn't enougth.
I change a litle and the new version is above:
<html>
<body>
<center><table border="1">
<tr>
<td></td>
</tr>
<tr>
<?php
For($m=-1;$m<2;$m++){
print "<td>";
$lastmonth = mktime (0, 0, 0, date("m")+$m, date("d"), date("Y"));
$s=0;
// Get the calender info
$t_days = cal_days_in_month(CAL_GREGORIAN, (date("m",$lastmonth) ),
date("Y",$lastmonth) );
$day = date("w", mktime(0, 0, 0, date("m",$lastmonth ), 1,
date("Y",$lastmonth )));
?>
<table border = "0">
<tr><th bgcolor = "yellow" colspan = "7"><?php echo
(date("F Y",$lastmonth )); ?></th></tr>
<tr><th>Sun</th><th>Mon</th><th>Tue</th>
<th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>
<?php
for ($i = 0; $i <= $t_days; $i++)
{
if ($day > 6) {$s++;
echo "</tr>\n<tr>\n";
$day = 0; }
//------------------------------------------------//
if ($i == date("j")&& $m == 0) {?>
<td align = "center"><b><?php echo $i; $day++; echo
"</b></td>\n"; }
else if ($i > 0) {?>
<td align = "center"><?php echo $i; $day++; echo
"</td>\n"; }
else if ($day > 0) {?>
<tr><td colspan = "<?php echo $day; ?>"><?php echo
"</td>\n"; }
//-----------------------------------------------//
if ($i == $t_days && $day < 6) {?>
<td colspan = "<?php echo 7 - $day; ?>"><?php echo
"</td>\n</tr>\n"; }
}
if ($s==4){print "<tr>\n<td> </td></tr>";
}
?>
</table></td>
<?php
}?>
</tr></table>
</center>
</body>
</html>
----
Manual Page -- http://www.php.net/manual/en/ref.calendar.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43709
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43709&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43709&report=yes
Search -- http://master.php.net/manage/user-notes.php