Difference between revisions of "Calendar.php"

From Organic Design wiki
m
(reduce font size)
Line 2: Line 2:
  
 
function month( $m, $y ) {
 
function month( $m, $y ) {
$c = '';
+
$c = 'style="font-size:8pt"';
 
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=0><tr><th colspan=7$c><h2>$month</h2>\n<tr>";
+
$article = "<table border=0><tr><th colspan=7$c><h3>$month</h3>\n<tr>";
 
$article .= "<th$c>M<th$c>T<th$c>W<th$c>T<th$c>F<th$c>S<th$c>S\n";
 
$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 .= '<tr>'.str_repeat( '<td>', $d-1 );
 
if ( $d > 1 ) $article .= '<tr>'.str_repeat( '<td>', $d-1 );

Revision as of 03:00, 7 March 2006

<?

function month( $m, $y ) { $c = 'style="font-size:8pt"'; if ( !$d = date( 'w', $ts = mktime( 0, 0, 0, $m, 1, $y) ) ) $d = 7; $month = date( 'F', $ts );

$article = "

";

$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( '"; $article .= "<td$c> $day "; } } $article .= "\n

$month

\n
', $d-1 );

for ( $i = $d; $i < 39; $i++ ) { $day = $i - $d + 1; $day = $day < 10 ? "0$day" : $day; if ( checkdate( $m, $day, $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 .= '

';

?>