ปฏิทินอย่างง่ายด้วย php และ css

25 September 2008

CSS Code

 <style type="text/css">
#calendar_css {
	background-color:#F0F0F0;
	border-style:solid;
	border-width:0px;
	border-right-width:0px;
	border-bottom-width:0px;
	border-color:#cccccc;
}
#calendar_css td{
	text-align:center;
	font:11px tahoma;
	width:2%;
	height:18px;
}
#calendar_css thead{
	text-align:center;
	font:11px tahoma;
	width:2%;
	height:18px;
	background-color:#333333;
	color:#FFFFFF;
}
#calendar_css .current{
	text-align:center;
	font:11px tahoma;
	width:2%;
	height:18px;
	background-color:#FF0000;
	color:#FFFFFF;
}
col.holidayCol{
	background-color:#FDDFE4;
	color:#FF0000;
}
td.monthTitle{
	background-color:#666666;
	text-align:center;
	font:11px bold tahoma;	
}
 </style>

PHP Code

<?php   
$day_now=array("Sun"=>"1","Mon"=>"2","Tue"=>"3","Wed"=>"4","Thu"=>"5","Fri"=>"6","Sat"=>"7");   
$first_day=date("D",mktime(0,0,1,intval(date("m")),1,date("Y")));   
$start_td=$day_now[$first_day]-1;      
$num_day=date("t");   
$num_day2=($num_day+$start_td);   
$num_day3=(7*ceil($num_day2/7));   
?>   
<table id="calendar_css" width="175" border="0" cellspacing="0" cellpadding="0">   
<colgroup>   
<col class="holidayCol" />   
<col span="5" />   
<col class="holidayCol" />   
</colgroup>   
<thead>   
<tr>
<td colspan="7" class="monthTitle">
<?=date("M-Y")?>
</td>
</tr>
  <tr>   
    <td>อา </td>   
    <td>จ </td>   
    <td>อ </td>   
    <td>พ </td>   
    <td>พฤ </td>   
    <td>ศ </td>   
    <td>ส </td>   
  </tr>   
</thead>   
<?php for($i=1;$i <=$num_day3;$i++){ ?>   
<?php if($i%7==1){ ?>   
  <tr>   
  <?php } ?>   
    <td   <?=(date("j")==$i-$start_td)?"class=\"current\"":""?>> <?=($i-$start_td>=1 && $i-$start_td <=$num_day)?$i-$start_td:" "?> </td>   
<?php if($i%7==0){ ?>   
  </tr>   
  <?php } ?>   
<?php } ?>   
</table>  

ตัวอย่าง

Dec-2009
อา พฤ
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31







บทความในหมวดที่่น่าสนใจ อื่นๆ PHP Learning

25 Sep 08 Upload รูปภาพ หรือไฟล์ด้วย ฟังก์ชั่น ใช้ง่าย อ่าน 4705 18 Aug 10 ใช้ php ดึงรูปภาพ จากโฟลเดอร์ มาแสดง พร้อม เทคนิค แบ่งหน้า อ่าน 4561 14 Feb 09 คำนวณหาอายุ จากวันเกิด ด้วย php อ่าน 4559 30 Oct 08 ฟังก์ชันตรวจสอบอีเมลล์ ด้วย php ละเอียดมากขึ้น php check verify email อ่าน 4399 25 Sep 08 ใช้ PHP สร้าง Javascript อย่างง่าย อ่าน 4192 14 Sep 10 การดึงข้อมูล จากฐานข้อมูล สร้าง xml ไฟล์ ด้วย php อ่าน 4054 24 Aug 10 ประยุกต์ ใช้รายการ จากฐานข้อมูล สร้างปฏิทินกิจกรรม ด้วย fullcalendar และ jQuery อ่าน 3990 23 Dec 09 จัดรูปแบบ การแบ่งคอลัมน์ column ของ ตาราง สำหรับแสดงข้อมูล ด้วย php อ่าน 3913 29 Mar 09 ทบทวนการตัดข้อความด้วย PHP อ่าน 3758 25 Sep 08 Authentication ป้องกันไฟล์ด้วย php อ่าน 3749 06 Oct 10 การใช้งาน graph api ของ facebook ด้วย php sdk อ่าน 3696 18 Mar 09 สร้างฟังก์ชัน PHP กำหนดเวลาหมดอายุให้ัตัวแปร SESSION อย่างง่าย อ่าน 3680 10 Nov 08 ฟังก์ชัน PHP ตัดข้อความยาวด้วย wordwrap อ่าน 3638 08 Oct 10 การอัพเดท สถานะบน facebook อัตโนมัติ แบบ graph api ด้วย php sdk อ่าน 3532 09 Oct 10 สร้าง album และ อัพโหลด รูป photo ขึ้น facebook ด้วย php sdk อ่าน 3487

บทความคนเข้าอ่านวันนี้

24 Feb 09 สร้างรูปแบบข้อความ เบอร์โทร เลขที่บัตรประชาชน เวลา ด้วย javascript อ่าน 4622 16 Sep 10 เพิ่มความสะดวก การ insert update delete ข้อมูล ของ mysql ด้วย php function อ่าน 7300 25 Sep 08 javasdcript กับการเข้ารหัส encoding และการถอดรหัส decoding อ่าน 3800 30 Sep 08 สร้างฟังก์ชัน PHP แยกตัวเลขจากข้อความ อย่างง่าย อ่าน 1762 25 Sep 08 แปลงค่าตัวแปรเป็นตัวแปร Number ด้วยฟังก์ชัน parseInt() และ parseFloat() อ่าน 3240 17 Jan 11 เทคนิค วิธี การแสดงข้อมูล ด้วยเงื่อนไข วันที่ date ใน mysql อ่าน 3187 18 Dec 09 สร้างไฟล์ word จาก html ด้วย php class ได้อย่างง่าย อ่าน 1959 28 Oct 09 สร้าง Swap Banner แบนเนอร์แบบสลับอัตโนมัติ ด้วย jQuery อย่างง่าย อ่าน 4187 13 Oct 08 คำสั่ง SQL AND OR อ่าน 3103 06 May 10 สร้าง poll แบบสำรวจ ด้วย ajax ใน jQuery อย่างง่าย อ่าน 4033 30 Nov 10 การนำเสนอ และแสดงข้อมูล ด้วย jQuery Flexigrid Plugin เบื้องต้น อ่าน 4211 25 Sep 08 หาตำแหน่งของ element แนวแกน x แกน y ด้วยฟังก์ชันของ jQuery อ่าน 2583 02 Apr 10 สร้าง layout 3 คอลัมน์ column ให้ สูงเท่ากัน ด้วย เทคนิค css อ่าน 4630 17 Dec 10 สร้าง php ฟังก์ชัน ตราจสอบ ก่อนถึงวันหมดอายุ อย่างง่าย อ่าน 1827 25 Sep 08 ปฏิทินอย่างง่ายด้วย php และ css อ่าน 5110 29 Sep 10 แนวทาง การสร้าง ระบบตรวจสอบ การล็อกอิน อย่างง่าย ด้วย ajax ใน jQuery และ php อ่าน 3860 09 May 10 ดึงค่า ข้อมูล จาก xml ไฟล์ มากำหนดเป็นตัวแปร array ด้วย php อ่าน 2149 19 Sep 10 DirectionsService DirectionsRenderer ค้นหา และสร้าง เส้นทางใน google map อ่าน 2978 25 Sep 08 ตรวจสอบสถานะของ MySQL ด้วย phpinfo อ่าน 1790 08 Feb 11 แท็บเมนู tab menu แนวตั้งอย่างง่าย ด้วย jQuery อ่าน 3988
จำนวนผู้เยี่ยมชม 784651
คน 2012 © Copyright ninenik.com. All rights reserved.