본문
이번달 달력(양력)을 표시하는 소스입니다. 조금만 응용하면 여러가지 모양이 나올 수 있겠죠!
<?php
// 지정한 년,월의 총 일수를 구한다.
function cal_days_in_month($month, $year) {
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
?>
<?php
$date_month = date("m"); //오늘이 속한 월(1,2,3...12)
$date_year = date("Y"); //오늘이 속한 년(...2003,2004,2005...)
$t_days = cal_days_in_month($date_month, $date_year); //지정한 년,월의 총 일수(28,29,30,31)
$day = date("w", mktime(0, 0, 0, $date_month, 1, $date_year)); //0(일요일)부터 6(토요일)
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>달력</title>
<style type=text/css>
td { font-size:12px; font-family:돋움체; color:#7D7D7D; line-height:1.2; }
th { font-size:13px; font-family:돋움체; color:#000000; line-height:1.5; }
.today { font-size:12px; font-family:돋움체; color:#000000; background:#C4E1FF line-height:1.2; }
</style>
</head>
<body bgcolor=#FFFFFF>
<table border="0" bgcolor="#F2F2F2" cellpadding="2" cellspacing="2">
<tr><th colspan="7"><?php echo $date_year."년 ".$date_month."월"; ?></th></tr>
<tr bgcolor="#C0C0C0"><th><font color="#FF0000">일</font></th><th>월</th><th>화</th><th>수</th>
<th>목</th><th>금</th><th><font color="#0000FF">토</font></th></tr>
<?php
for ($i = 0; $i <= $t_days; $i++) {
if ($day > 6) {
echo "</tr>\n<tr>\n";
$day = 0;
}
if ($i == date("j")) { ?>
<td align="right" class="today"><?php echo $i; $day++; echo "</td>\n";
}
else if ($i > 0) { ?>
<td align="right"><?php echo $i; $day++; echo "</td>\n";
}
else if ($day > 0) { ?>
<tr><td colspan="<?php echo $day; ?>"><?php echo "</td>\n";
}
if ($i == $t_days && $day < 6) { ?>
<td colspan="<?php echo 7 - $day; ?>"><?php echo "</td>\n</tr>\n";
}
}
?>
</table>
</body>
</html><
<?php
// 지정한 년,월의 총 일수를 구한다.
function cal_days_in_month($month, $year) {
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
?>
<?php
$date_month = date("m"); //오늘이 속한 월(1,2,3...12)
$date_year = date("Y"); //오늘이 속한 년(...2003,2004,2005...)
$t_days = cal_days_in_month($date_month, $date_year); //지정한 년,월의 총 일수(28,29,30,31)
$day = date("w", mktime(0, 0, 0, $date_month, 1, $date_year)); //0(일요일)부터 6(토요일)
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>달력</title>
<style type=text/css>
td { font-size:12px; font-family:돋움체; color:#7D7D7D; line-height:1.2; }
th { font-size:13px; font-family:돋움체; color:#000000; line-height:1.5; }
.today { font-size:12px; font-family:돋움체; color:#000000; background:#C4E1FF line-height:1.2; }
</style>
</head>
<body bgcolor=#FFFFFF>
<table border="0" bgcolor="#F2F2F2" cellpadding="2" cellspacing="2">
<tr><th colspan="7"><?php echo $date_year."년 ".$date_month."월"; ?></th></tr>
<tr bgcolor="#C0C0C0"><th><font color="#FF0000">일</font></th><th>월</th><th>화</th><th>수</th>
<th>목</th><th>금</th><th><font color="#0000FF">토</font></th></tr>
<?php
for ($i = 0; $i <= $t_days; $i++) {
if ($day > 6) {
echo "</tr>\n<tr>\n";
$day = 0;
}
if ($i == date("j")) { ?>
<td align="right" class="today"><?php echo $i; $day++; echo "</td>\n";
}
else if ($i > 0) { ?>
<td align="right"><?php echo $i; $day++; echo "</td>\n";
}
else if ($day > 0) { ?>
<tr><td colspan="<?php echo $day; ?>"><?php echo "</td>\n";
}
if ($i == $t_days && $day < 6) { ?>
<td colspan="<?php echo 7 - $day; ?>"><?php echo "</td>\n</tr>\n";
}
}
?>
</table>
</body>
</html><
첨부파일
달력.txt (1.9 KB, 28회)댓글 4개
천재조상훈
12년 전
감사요
12년 전
감사
12년 전
감사
12년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8130 | 9년 전 | 576 | ||
| 8129 |
|
9년 전 | 689 | |
| 8128 | 9년 전 | 544 | ||
| 8127 |
|
9년 전 | 591 | |
| 8126 | 9년 전 | 525 | ||
| 8125 | 9년 전 | 779 | ||
| 8124 |
|
9년 전 | 539 | |
| 8123 | 9년 전 | 524 | ||
| 8122 | 9년 전 | 456 | ||
| 8121 | 9년 전 | 563 | ||
| 8120 | 9년 전 | 482 | ||
| 8119 | 9년 전 | 571 | ||
| 8118 |
|
9년 전 | 648 | |
| 8117 |
|
9년 전 | 416 | |
| 8116 |
PASKRAN
|
9년 전 | 474 | |
| 8115 | 9년 전 | 470 | ||
| 8114 |
kiplayer
|
9년 전 | 608 | |
| 8113 | 9년 전 | 467 | ||
| 8112 |
|
9년 전 | 576 | |
| 8111 | 9년 전 | 414 | ||
| 8110 | 9년 전 | 457 | ||
| 8109 | 9년 전 | 388 | ||
| 8108 |
|
9년 전 | 566 | |
| 8107 |
|
9년 전 | 454 | |
| 8106 |
|
9년 전 | 456 | |
| 8105 | 9년 전 | 486 | ||
| 8104 |
|
9년 전 | 451 | |
| 8103 |
|
9년 전 | 451 | |
| 8102 |
|
9년 전 | 424 | |
| 8101 |
snshero
|
9년 전 | 811 | |
| 8100 | 9년 전 | 857 | ||
| 8099 | 9년 전 | 835 | ||
| 8098 | 9년 전 | 737 | ||
| 8097 | 9년 전 | 541 | ||
| 8096 | 9년 전 | 739 | ||
| 8095 | 9년 전 | 878 | ||
| 8094 | 9년 전 | 550 | ||
| 8093 | 9년 전 | 825 | ||
| 8092 | 9년 전 | 775 | ||
| 8091 | 9년 전 | 1161 | ||
| 8090 | 9년 전 | 785 | ||
| 8089 | 9년 전 | 1000 | ||
| 8088 | 9년 전 | 661 | ||
| 8087 | 9년 전 | 789 | ||
| 8086 | 9년 전 | 536 | ||
| 8085 | 9년 전 | 501 | ||
| 8084 | 9년 전 | 620 | ||
| 8083 | 9년 전 | 593 | ||
| 8082 | 9년 전 | 782 | ||
| 8081 | 9년 전 | 493 | ||
| 8080 | 9년 전 | 587 | ||
| 8079 | 9년 전 | 546 | ||
| 8078 | 9년 전 | 465 | ||
| 8077 | 9년 전 | 556 | ||
| 8076 | 9년 전 | 425 | ||
| 8075 | 9년 전 | 458 | ||
| 8074 | 9년 전 | 424 | ||
| 8073 | 9년 전 | 478 | ||
| 8072 | 9년 전 | 469 | ||
| 8071 |
o1o111
|
9년 전 | 919 | |
| 8070 | 9년 전 | 427 | ||
| 8069 | 9년 전 | 365 | ||
| 8068 | 9년 전 | 616 | ||
| 8067 | 9년 전 | 416 | ||
| 8066 | 9년 전 | 443 | ||
| 8065 | 9년 전 | 403 | ||
| 8064 | 9년 전 | 397 | ||
| 8063 | 9년 전 | 364 | ||
| 8062 | 9년 전 | 334 | ||
| 8061 | 9년 전 | 369 | ||
| 8060 | 9년 전 | 413 | ||
| 8059 | 9년 전 | 345 | ||
| 8058 | 9년 전 | 283 | ||
| 8057 | 9년 전 | 412 | ||
| 8056 | 9년 전 | 330 | ||
| 8055 | 9년 전 | 377 | ||
| 8054 | 9년 전 | 383 | ||
| 8053 | 9년 전 | 436 | ||
| 8052 | 9년 전 | 306 | ||
| 8051 | 9년 전 | 356 | ||
| 8050 | 9년 전 | 413 | ||
| 8049 | 9년 전 | 347 | ||
| 8048 | 9년 전 | 452 | ||
| 8047 | 9년 전 | 388 | ||
| 8046 | 9년 전 | 333 | ||
| 8045 | 9년 전 | 281 | ||
| 8044 | 9년 전 | 367 | ||
| 8043 | 9년 전 | 323 | ||
| 8042 | 9년 전 | 314 | ||
| 8041 | 9년 전 | 375 | ||
| 8040 | 9년 전 | 300 | ||
| 8039 | 9년 전 | 338 | ||
| 8038 | 9년 전 | 281 | ||
| 8037 | 9년 전 | 428 | ||
| 8036 | 9년 전 | 516 | ||
| 8035 | 9년 전 | 447 | ||
| 8034 | 9년 전 | 407 | ||
| 8033 | 9년 전 | 369 | ||
| 8032 | 9년 전 | 474 | ||
| 8031 | 9년 전 | 365 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기