Difference between revisions of "Calendar.php"

From Organic Design wiki
(mixed up td's and th's)
($d not $day)
Line 2: Line 2:
  
 
function month( $m, $y ) {
 
function month( $m, $y ) {
$c = ' align=center';
+
$c = '';
if ( !$day = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $day = 7;
+
if ( !$d = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $ = 7;
 
$month = date( 'F', $ts );
 
$month = date( 'F', $ts );
 
$article = "<table border=0><tr><th colspan=7$c>$month";
 
$article = "<table border=0><tr><th colspan=7$c>$month";

Revision as of 02:44, 7 March 2006

<?

function month( $m, $y ) { $c = ; if ( !$d = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $ = 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 = $d < 10 ? "0$d" : $d; $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 .= '

';

?>