Calendar.php

From Organic Design wiki
Revision as of 02:45, 7 March 2006 by Nad (talk | contribs) ($i not $d)

<?

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

$article = "

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

';

?>