|
Posted by Troy Piggins on 01/02/07 23:46
I have a php page[1] with 'includes'[2]. The page correctly
displays a calendar of the current month and current year if
$Month and $Year are not assigned, but if I try to call the page
with blog.php?Month=12&Year=2006 in the URL nothing seems to
change. Any ideas?
[1] blog.php
[snip html headers etc]
<?php
$Title= "Blog";
include( "calendar.php");
?>
[snip body and footers etc]
[2] calendar.php
<?php
if( !$Month) $Month= date( "m");
if( !$Year) $Year= date( "Y");
$Timestamp= mktime( 0, 0, 0, $Month, 1, $Year);
$MonthName= date( "F", $Timestamp);
print( "<table border=0 cellpadding=1 cellspacing=0 align=center>");
print( "<tr><td colspan=7 align=center>$MonthName</td></tr>");
print( "<tr>
<td>Su</td>
<td>Mo</td>
<td>Tu</td>
<td>We</td>
<td>Th</td>
<td>Fr</td>
<td>Sa</td>
</tr>\n");
$MonthStart= date( "w", $Timestamp);
if( $MonthStart == 0) {
$MonthStart= 7;
}
$LastDay= date( "d", mktime( 0, 0, 0, $Month+1, 0, $Year));
$StartDate= -$MonthStart;
for( $k=1; $k<=6; $k++) {
print( "<tr>");
for( $i=1; $i<=7; $i++) {
$StartDate++;
if( ( $StartDate<=0) || ( $StartDate>$LastDay)) {
print( "<td> </td>");
} elseif ( ( $StartDate>=1) && ($StartDate<=$LastDay)) {
print( "<td>$StartDate</td>");
}
}
print( "</tr>\n");
}
print( "</table>");
?>
--
Troy Piggins ,-O (o- O All your sigs are belong to us.
http://piggo.com/~troy O ) //\ O
RLU#415538 `-O V_/_ OOO
hackerkey://v3sw5HPUhw5ln4pr6OSck1ma9u6LwXm5l6Di2e6t5MGSRb8OTen4g7OPa3Xs7MIr8p7
[Back to original message]
|