Difference between revisions of "Calendar.php"

From Organic Design wiki
m
m
Line 5: Line 5:
 
if ( !$d = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $d = 7;
 
if ( !$d = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $d = 7;
 
$month = date( 'F', $ts );
 
$month = date( 'F', $ts );
$article = "<table border=1><tr><th colspan=7$c>$month";
+
$article = "<table border=0><tr><th colspan=7$c>$month";
 
$article .= "\n<tr><th$c>M<th$c>T<th$c>W<th$c>T<th$c>F<th$c>S<th$c>S\n";
 
$article .= "\n<tr><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 .= '<tr>'.str_repeat( '<td>', $d-1 );
 
if ( $d > 1 ) $article .= '<tr>'.str_repeat( '<td>', $d-1 );
for ( $i = $d; $i < 32; $i++ ) if ( checkdate( $m, $i, $y ) ) {
+
for ( $i = $d; $i < 39; $i++ ) if ( checkdate( $m, $i, $y ) ) {
 
if ( $i%7 == 1 ) $article .= "\n<tr>";
 
if ( $i%7 == 1 ) $article .= "\n<tr>";
 
$day = $i - $d + 1;
 
$day = $i - $d + 1;

Revision as of 02:53, 7 March 2006

<?

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 - $d + 1; $day = $day < 10 ? "0$day" : $day; $article .= "<td$c>$day"; } $article .= "\n
$month"; $article .= "\n
', $d-1 );

for ( $i = $d; $i < 39; $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 .= '

';

?>