본문
이번달 달력(양력)을 표시하는 소스입니다. 조금만 응용하면 여러가지 모양이 나올 수 있겠죠!
<?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년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6830 |
112211dd
|
11년 전 | 787 | |
| 6829 |
진짜다진짜가나타남
|
11년 전 | 1185 | |
| 6828 | 11년 전 | 817 | ||
| 6827 |
봉보로봉봉
|
11년 전 | 898 | |
| 6826 |
jinion
|
11년 전 | 815 | |
| 6825 | 11년 전 | 797 | ||
| 6824 |
yunkiri486
|
11년 전 | 713 | |
| 6823 |
2donggalbi
|
11년 전 | 847 | |
| 6822 | 11년 전 | 843 | ||
| 6821 | 11년 전 | 793 | ||
| 6820 | 11년 전 | 3098 | ||
| 6819 | 11년 전 | 1248 | ||
| 6818 | 11년 전 | 514 | ||
| 6817 |
|
11년 전 | 600 | |
| 6816 | 11년 전 | 2070 | ||
| 6815 | 11년 전 | 1208 | ||
| 6814 | 11년 전 | 851 | ||
| 6813 | 11년 전 | 598 | ||
| 6812 |
|
11년 전 | 979 | |
| 6811 | 11년 전 | 574 | ||
| 6810 | 11년 전 | 1534 | ||
| 6809 |
낚시가좋아
|
11년 전 | 1043 | |
| 6808 | 11년 전 | 437 | ||
| 6807 | 11년 전 | 757 | ||
| 6806 |
Unhappy
|
11년 전 | 1766 | |
| 6805 | 11년 전 | 1589 | ||
| 6804 | 11년 전 | 1115 | ||
| 6803 | 11년 전 | 550 | ||
| 6802 |
asdfg
|
11년 전 | 1130 | |
| 6801 |
아트귀농인
|
11년 전 | 498 | |
| 6800 | 11년 전 | 2551 | ||
| 6799 | 11년 전 | 1351 | ||
| 6798 | 11년 전 | 1466 | ||
| 6797 | 11년 전 | 623 | ||
| 6796 |
purple63
|
11년 전 | 424 | |
| 6795 | 11년 전 | 2630 | ||
| 6794 |
커네드커네드
|
11년 전 | 955 | |
| 6793 | 11년 전 | 399 | ||
| 6792 | 11년 전 | 2486 | ||
| 6791 | 11년 전 | 504 | ||
| 6790 | 11년 전 | 2248 | ||
| 6789 |
리아빌리티
|
11년 전 | 3090 | |
| 6788 | 11년 전 | 1341 | ||
| 6787 | 11년 전 | 670 | ||
| 6786 | 11년 전 | 386 | ||
| 6785 | 11년 전 | 714 | ||
| 6784 |
|
11년 전 | 837 | |
| 6783 | 11년 전 | 577 | ||
| 6782 | 11년 전 | 3651 | ||
| 6781 |
리아빌리티
|
11년 전 | 476 | |
| 6780 | 11년 전 | 517 | ||
| 6779 | 11년 전 | 475 | ||
| 6778 | 11년 전 | 4674 | ||
| 6777 |
바보온달123
|
11년 전 | 607 | |
| 6776 | 11년 전 | 921 | ||
| 6775 | 11년 전 | 722 | ||
| 6774 |
DANet
|
11년 전 | 631 | |
| 6773 | 11년 전 | 1557 | ||
| 6772 | 11년 전 | 1349 | ||
| 6771 | 11년 전 | 609 | ||
| 6770 | 11년 전 | 1154 | ||
| 6769 | 11년 전 | 943 | ||
| 6768 | 11년 전 | 680 | ||
| 6767 | 11년 전 | 575 | ||
| 6766 | 11년 전 | 1258 | ||
| 6765 |
크림나이트
|
11년 전 | 988 | |
| 6764 | 11년 전 | 1530 | ||
| 6763 | 11년 전 | 2590 | ||
| 6762 | 11년 전 | 522 | ||
| 6761 |
|
11년 전 | 777 | |
| 6760 |
|
11년 전 | 705 | |
| 6759 | 11년 전 | 3337 | ||
| 6758 | 11년 전 | 1004 | ||
| 6757 | 11년 전 | 1265 | ||
| 6756 | 11년 전 | 887 | ||
| 6755 |
|
11년 전 | 566 | |
| 6754 |
|
11년 전 | 708 | |
| 6753 |
|
11년 전 | 1373 | |
| 6752 | 11년 전 | 597 | ||
| 6751 |
|
11년 전 | 646 | |
| 6750 |
|
11년 전 | 2012 | |
| 6749 | 11년 전 | 1205 | ||
| 6748 |
|
11년 전 | 1110 | |
| 6747 | 11년 전 | 1154 | ||
| 6746 | 11년 전 | 826 | ||
| 6745 |
|
11년 전 | 902 | |
| 6744 | 11년 전 | 845 | ||
| 6743 | 11년 전 | 1272 | ||
| 6742 | 11년 전 | 524 | ||
| 6741 |
Abilityarch
|
11년 전 | 599 | |
| 6740 | 11년 전 | 638 | ||
| 6739 |
leewin20
|
11년 전 | 1226 | |
| 6738 | 11년 전 | 500 | ||
| 6737 | 11년 전 | 1210 | ||
| 6736 | 11년 전 | 1248 | ||
| 6735 | 11년 전 | 544 | ||
| 6734 | 11년 전 | 1277 | ||
| 6733 |
RipperTNT
|
11년 전 | 1835 | |
| 6732 |
|
11년 전 | 1334 | |
| 6731 |
|
11년 전 | 1383 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기