A-AA+then

โค้ดปฏิทินแบบง่ายๆ ด้วย PHP ที่สามารถแสดงได้ทีเดียวทั้งปีเลย

ดัดแปลงจากโค้ดของ http://www.weberdev.com

<style type="text/css">
th {
     font-size:12pt;
     line-height:14pt;
     font-family:Helvetica,Arial;
}
</style>

<?php
     $year = 2549 -543;
     print("<table border='0' width='200'> ");
     for($month=1;$month<13;$month++)
     {
          printf("<tr> <th colspan='7'>%s</th></tr> ",date("F",mktime(0,0,0,$month,1,$year)));
          printf("<tr><th>ÍÒ.</th><th>¨.</th><th>Í.</th><th>¾.</th><th>¾Ä.</th><th>È.</th><th>Ê.</th></tr>");
          $fdom=date("w",mktime(0,0,0,$month,1,$year));
          $ct=0;
          for($row=1;$row<7;$row++)
          {
               print(" <tr>");
               for($week=1;$week<8;$week++)
               {
                    $ct++;
                    $value=mktime(0,0,0,$month,$ct-$fdom,$year);
                    if (date("m",$value)==$month)
                    {
                         printf ("<th>%s</th>",date("d",$value));
                    }
                    else
                    {
                         print("<td></td>");
                    };
               };
               print("</tr> ");
          };
          print("<tr><td colspan='7'><br /><br /></td></tr>");
     };
     print("</table>");
?>

PHP

Relate

^