>> Edit article
이름
제목
패스워드
소스에 대한 질문입니다.. 아래의 소스중에서...현재는 년과 월별로 달력이 나오는 소스입니다.. 근데 제가 구현하고자하는 것은 오늘날짜 즉, 2001년 4월24일부터 출력하여 다음달 5월23일까지 출력을 할려고 합니다.. 4월 24일부터 당월 30일까지 출력하게는 할 수 있지만... 30일 뒤에 바로 5월달의 1일부터 23일까지 나올 수 있게 할려고 합니다.. 조건문에서 조금수정하면 될꺼 같은데.... 능력부족이라서 조건문을 달수가 없어서 이렇게 글을 남겨봅니다.. 아시면 답변좀 해주세요.....ㅠㅠ...부탁드립니다. ########## 해당연월의 일수를 계산한다. function get_totaldays($year,$month) { $date = 1; while(checkdate($month,$date,$year)) { $date++; } $date--; return $date; } ########## 해당연월의 달력을 출력한다. function showCalendar($year,$month,$total_days) { $first_day = date('w', mktime(0,0,0,$month,1,$year)); echo("$first_day<TABLE WIDTH='492' BORDER='0' cellspacing='0' cellpadding='1'> <TR><TD BGCOLOR='BLUE'> <TABLE BORDER='0' cellspacing='1' cellpadding='10' width=800> <TR> <TR> <TH bgColor='pink'>일</TH> <TH bgColor='pink'>월</TH> <TH bgColor='pink'>화</TH> <TH bgColor='pink'>수</TH> <TH bgColor='pink'>목</TH> <TH bgColor='pink'>금</TH> <TH bgColor='pink'>토</TH> </TR> <TR> "); $col = 0; for($i = 0; $i < $first_day; $i++) { echo(" <TD BGCOLOR='#FFFFFF'> </TD>"); $col++; } for($j = 1; $j <= $total_days; $j++) { echo(" <TD BGCOLOR='#FFFFFF'>$j</TD>"); $col++; if($col == 7) { echo("</TR>"); if($j != $total_days) { echo("<TR>"); } $col = 0; } } while($col > 0 && $col < 7) { echo(" <TD BGCOLOR='#FFFFFF'> </TD>"); $col++; } echo(" </TR> </TABLE> </TD></TR> </TABLE> "); } ?> <html> <head> <title>PHP로 구현하는 달력프로그램</title> <style type="text/css"> <!-- BODY,TR,TH,TD { font-family: "굴림"; font-size: 10pt; line-height : 12pt; } //--> </style> </head> <body bgColor="#FFFFFF"> <? $inputY = "2002"; $inputM = "2"; $totaldays = get_totaldays($inputY,$inputM); showCalendar($inputY,$inputM,$totaldays); ?> </body> </html>
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved