Difference between revisions of "Calendar"

From Organic Design wiki
(Starting a calender to see how it goes)
 
(Doesn't work executing from itself, do normal way)
Line 1: Line 1:
<?
 
  
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 = "<table border=0><tr><th colspan=7$c>$month";
 
$article .= "\n<th><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 .= '<tr>'.str_repeat( '<td>', $d-1 );
 
for ( $i = $d; $i < 32; $i++ ) if ( checkdate( $m, $i, $y ) ) {
 
if ( $i%7 == 1 ) $article .= "\n<tr>";
 
$day = $d < 10 ? "0$d" : $d;
 
$article .= "<td$c><b>[[$d $m $y|$d]]</b>";
 
}
 
$article .= "\n</table>";
 
return $article;
 
}
 
 
$article = "<table width=100% border=0 cellpadding=5 cellspacing=5><tr><td>\n";
 
$m = 1;
 
$y = date( 'Y' );
 
for ( $rows = 0; $rows < 3; $rows++ ) {
 
$article .= "\n<tr>";
 
for ( $cols = 0; $cols < 3; $cols++ )
 
$article .= "\n<td style='border:groove 2px #eeeeee'>".month( $m++, $y );
 
 
      }
 
$article .= '</table>';
 
?>
 

Revision as of 02:32, 7 March 2006