Jump to content

My Calendar Script


zppblood

Recommended Posts

You may use this script if you want for your site. Is there anything that you think need to be changed to make it better?

<style type="text/css">  .day {	text-align: center;  }  .ds {	text-align: right;  }</style><table border="1" width="20%"><tr>  <td colspan="7" align="center"><?php  $date=explode(' ', date('F n Y t'));  $days=array('S', 'M', 'T', 'W', 'T', 'F', 'S');  $fom=date('w', mktime(0, 0, 0, $date[1], 1, $date[2]));  $eom=date('w', mktime(0, 0, 0, $date[1], $date[3], $date[2]));  $space=0;  echo "{$date[0]} {$date[2]}</td>\n</tr>\n<tr>\n";  for ($i=0; $i<count($days); $i++) {	echo "  <td class=\"day\">{$days[$i]}</td>\n";  }  for ($j=0; $j<$date[3]+$fom+6-$eom; $j++) {	if ($j%7==0) {	  echo "</tr>\n<tr>\n";	}	echo "  <td class=\"ds\">";	if ($space<$fom) {		echo " ";		$space++;	}	elseif ($j-$fom>=$date[3]) {	  echo " ";	}	else {	  echo $j-$fom+1;	}	echo "</td>\n";  }?></tr></table>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...