Difference between revisions of "Calendar.php"

From Organic Design wiki
(Put code here instead)
 
m
Line 11: Line 11:
 
if ( $i%7 == 1 ) $article .= "\n<tr>";
 
if ( $i%7 == 1 ) $article .= "\n<tr>";
 
$day = $d < 10 ? "0$d" : $d;
 
$day = $d < 10 ? "0$d" : $d;
$article .= "<td$c><b>[[$d $m $y|$d]]</b>";
+
$article .= "<td$c><b>[[$day $m $y|$day]]</b>";
 
}
 
}
 
$article .= "\n</table>";
 
$article .= "\n</table>";
Line 22: Line 22:
 
for ( $rows = 0; $rows < 3; $rows++ ) {
 
for ( $rows = 0; $rows < 3; $rows++ ) {
 
$article .= "\n<tr>";
 
$article .= "\n<tr>";
for ( $cols = 0; $cols < 3; $cols++ )
+
for ( $cols = 0; $cols < 4; $cols++ )
 
$article .= "\n<td style='border:groove 2px #eeeeee'>".month( $m++, $y );
 
$article .= "\n<td style='border:groove 2px #eeeeee'>".month( $m++, $y );
  

Revision as of 02:35, 7 March 2006

<?

function month( $m, $y ) { $c = ' align=center'; if ( !$day = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $day = 7; $month = date( 'F', $ts );

$article = "

'.str_repeat( '"; $day = $d < 10 ? "0$d" : $d; $article .= "<td$c>$day"; } $article .= "\n
$month"; $article .= "\n<td$c>M<td$c>T<td$c>W<td$c>T<td$c>F<td$c>S<td$c>S\n"; if ( $d > 1 ) $article .= '
', $d-1 );

for ( $i = $d; $i < 32; $i++ ) if ( checkdate( $m, $i, $y ) ) {

if ( $i%7 == 1 ) $article .= "\n

";

return $article; }

$article = "

"; for ( $cols = 0; $cols < 4; $cols++ ) $article .= "\n
\n";

$m = 1; $y = date( 'Y' ); for ( $rows = 0; $rows < 3; $rows++ ) {

$article .= "\n
".month( $m++, $y );
      }
$article .= '

';

?>