웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
<!--
// 달력
// 작성자 : 최문혁
// 작성일 : 2005-9-5
-->
<style>
a:link{color:white;text-decoration:none;}
a:visited{color:white;text-decoration:none;}
a:active{color:white;text-decoration:none;}
a:hover{color:#ff0000;text-decoration:underline}
</style>
<?php
//$curM = 2;
//처음 시작할때.. 그러니까 월을 선택하지 않았을때...
if ($curM =="")
{
//오늘을 기준으로 연도와 달을 찾는다.
$tmpDate = getdate();
$curY = $tmpDate[year];
$curM = $tmpDate[mon];
$curD = $tmpDate[mday];
}
//유닉스 타임스탬프 형식으로 현재달의 1일을 찾아 둔다.
$preM = $curM - 1;
$nextM = $curM + 1;
$preY = $curY;
$nextY = $curY;
if ($curM==1)
{
$preM = 12;
$preY = $curY - 1;
}
elseif($curM==12)
{
$nextM = 1;
$nextY = $curY + 1;
}
$preDate = mktime(0,0,0,$preM, 1,$preY);
$curDate = mktime(0,0,0,$curM, 1,$curY);
$nextDate = mktime(0,0,0,$nextM, 1,$nextY);
$preMaxday = date(t,$preDate);
$curMaxday = date(t,$curDate);
$nextMaxday = date(t,$nextDate);
$preFw = date(w,$preDate); //요일을 숫자로 나타낸것(0=일요일,1=월요일)
$curFw = date(w,$curDate); //요일을 숫자로 나타낸것(0=일요일,1=월요일)
$nextFw = date(w,$nextDate); //요일을 숫자로 나타낸것(0=일요일,1=월요일)
$preJu = floor(($preMaxday+$preFw)/7)+1 ; //
$curJu =floor(($curMaxday+$curFw)/7)+2 ; //
$nextJu = floor(($nextMaxday+$nextFw)/7)+1 ; //
$yoil = array('','SUN','MON','TUE','WEN','THR','FRI','SAT');
$month = array('','January','February','May','April','March','June'+ ','July','August','September','October','November','December');
//양옆 미니달력 만들기 함수
function mk_mCal($y,$m,$ju,$fw,$maxday)
{
GLOBAL $preM, $preY, $preJu, $preFw, $preMaxday, $nextJu, $nextFw, $nextMaxday, $yoil, $month;
$cur=0;
echo "<center><font face=굴림 size=2 color='#3399FF'>".$y."-".$m."</font></center><table cellspacing=2 cellpadding=0 height=150>";
for($row = 0;$row<=$ju;$row++)
{
echo "<tr align=center>";
for($col = 1;$col<=7;$col++)
{
echo "<td><font face=굴림 size=2 color='#3399FF'>";
if ($row==0)
{
echo "<u>".$yoil[$col]."</u>";
}
else
{
$cur++;
if (($cur <= $fw) || ($cur-$fw>$maxday)==true)
{
echo " ";
}
else
{
if ($cur-$preFw<10)
{
echo "0";
echo $cur-$fw;
}
else
{
echo $cur-$fw;
}//헉
}//헉
}//헉
}//헉
}//헉
echo "</table>";
}
//좌측,우측에 작은 달력.
echo "<table width=100% ><tr><td>";
//여기 전달 달력
mk_mCal($preY,$preM,$preJu, $preFw, $preMaxday);
echo "</td><td width=70% align=center>";
//여기 현재 달
echo "<b>".$curY." <font size=10>".$curM."</font> ".$month[$curM]."</font></b>";
echo "</td><td>";
//여기 다음달 달력
mk_mCal($nextY,$nextM,$nextJu,$nextFw,$nextMaxday);
echo "</td></tr></table>";
//메인테이블 시작
$cur = 0;
echo "<table border=0 width=100% height=70% cellspacing=1 cellpadding=0 bgcolor='#6699CC'>";
for($row = 0;$row<=$curJu;$row++)
{
//row에 대한 첫번째 루프라면 현재달과 전달 다음달을 표시하기위한 칸
if ($row==0)
{
echo "<tr height=10><td colspan=3><font size=2 color=white> <a href=$PHP_SELF?curY=$preY&curM=$preM&curD=$curD>이전달</a> ";
echo "<a href=$PHP_SELF>오늘</a> <a href=$PHP_SELF?curY=$nextY&curM=$nextM&curD=$curD>다음달</a></font></td></tr>";
}
else
{
echo "<tr bgcolor='#FFFFFF'>"; //한줄 그린다.
for($col = 1;$col<=7;$col++) //한주가 7일이니깐 7번 돈다.
{
if($row==1) //요일을 넣기위한 칸^^
{
echo "<td height=30 width=14.2857% align=center><font face='arial black'>";
echo "<font color=black>";
if ($col==1) echo "<font color=red>";
if ($col==7) echo "<font color=blue>";
echo "<h4>$yoil[$col]</h></font><br>";
}else{
$cur++; //공백까지 포함해서 1씩 증가하는데, 일자를 출력할땐 공백의 갯수 뺀다.
if (($cur<=$curFw) || ($cur > ($curMaxday+$curFw)) == true)
{
echo "<td valign=top> ";
}else{
if (($cur-$curFw)==$curD)//오늘일자 하이라이트.
{
echo "<td valign=top bgcolor=#6699CC>"; //한칸 그리고
}else{
echo "<td valign=top>"; //한칸 그리고
}
//일자 표시 부분... 각각 테이블이 들어간다. 디자인을 위해서..
echo "<table border=0 height=10 width=100% height=100% bgcolor=EEEEEE cellspacing=0 cellpadding=0><tr><td align=right>";
echo "<font color=black>";
if ($col==1) echo "<font color=red>";
if ($col==7) echo "<font color=blue>";
echo $cur-$curFw;
echo "</font> </td></tr></table>";
}
}
echo "</td>";
}
echo "</tr>";
}
}
echo "</table>";
?>
이쁜 달력소스입니다.
2005.09.05 22:35
<!--
// 달력
// 작성자 : 최문혁
// 작성일 : 2005-9-5
-->
<style>
a:link{color:white;text-decoration:none;}
a:visited{color:white;text-decoration:none;}
a:active{color:white;text-decoration:none;}
a:hover{color:#ff0000;text-decoration:underline}
</style>
<?php
//$curM = 2;
//처음 시작할때.. 그러니까 월을 선택하지 않았을때...
if ($curM =="")
{
//오늘을 기준으로 연도와 달을 찾는다.
$tmpDate = getdate();
$curY = $tmpDate[year];
$curM = $tmpDate[mon];
$curD = $tmpDate[mday];
}
//유닉스 타임스탬프 형식으로 현재달의 1일을 찾아 둔다.
$preM = $curM - 1;
$nextM = $curM + 1;
$preY = $curY;
$nextY = $curY;
if ($curM==1)
{
$preM = 12;
$preY = $curY - 1;
}
elseif($curM==12)
{
$nextM = 1;
$nextY = $curY + 1;
}
$preDate = mktime(0,0,0,$preM, 1,$preY);
$curDate = mktime(0,0,0,$curM, 1,$curY);
$nextDate = mktime(0,0,0,$nextM, 1,$nextY);
$preMaxday = date(t,$preDate);
$curMaxday = date(t,$curDate);
$nextMaxday = date(t,$nextDate);
$preFw = date(w,$preDate); //요일을 숫자로 나타낸것(0=일요일,1=월요일)
$curFw = date(w,$curDate); //요일을 숫자로 나타낸것(0=일요일,1=월요일)
$nextFw = date(w,$nextDate); //요일을 숫자로 나타낸것(0=일요일,1=월요일)
$preJu = floor(($preMaxday+$preFw)/7)+1 ; //
$curJu =floor(($curMaxday+$curFw)/7)+2 ; //
$nextJu = floor(($nextMaxday+$nextFw)/7)+1 ; //
$yoil = array('','SUN','MON','TUE','WEN','THR','FRI','SAT');
$month = array('','January','February','May','April','March','June'+ ','July','August','September','October','November','December');
//양옆 미니달력 만들기 함수
function mk_mCal($y,$m,$ju,$fw,$maxday)
{
GLOBAL $preM, $preY, $preJu, $preFw, $preMaxday, $nextJu, $nextFw, $nextMaxday, $yoil, $month;
$cur=0;
echo "<center><font face=굴림 size=2 color='#3399FF'>".$y."-".$m."</font></center><table cellspacing=2 cellpadding=0 height=150>";
for($row = 0;$row<=$ju;$row++)
{
echo "<tr align=center>";
for($col = 1;$col<=7;$col++)
{
echo "<td><font face=굴림 size=2 color='#3399FF'>";
if ($row==0)
{
echo "<u>".$yoil[$col]."</u>";
}
else
{
$cur++;
if (($cur <= $fw) || ($cur-$fw>$maxday)==true)
{
echo " ";
}
else
{
if ($cur-$preFw<10)
{
echo "0";
echo $cur-$fw;
}
else
{
echo $cur-$fw;
}//헉
}//헉
}//헉
}//헉
}//헉
echo "</table>";
}
//좌측,우측에 작은 달력.
echo "<table width=100% ><tr><td>";
//여기 전달 달력
mk_mCal($preY,$preM,$preJu, $preFw, $preMaxday);
echo "</td><td width=70% align=center>";
//여기 현재 달
echo "<b>".$curY." <font size=10>".$curM."</font> ".$month[$curM]."</font></b>";
echo "</td><td>";
//여기 다음달 달력
mk_mCal($nextY,$nextM,$nextJu,$nextFw,$nextMaxday);
echo "</td></tr></table>";
//메인테이블 시작
$cur = 0;
echo "<table border=0 width=100% height=70% cellspacing=1 cellpadding=0 bgcolor='#6699CC'>";
for($row = 0;$row<=$curJu;$row++)
{
//row에 대한 첫번째 루프라면 현재달과 전달 다음달을 표시하기위한 칸
if ($row==0)
{
echo "<tr height=10><td colspan=3><font size=2 color=white> <a href=$PHP_SELF?curY=$preY&curM=$preM&curD=$curD>이전달</a> ";
echo "<a href=$PHP_SELF>오늘</a> <a href=$PHP_SELF?curY=$nextY&curM=$nextM&curD=$curD>다음달</a></font></td></tr>";
}
else
{
echo "<tr bgcolor='#FFFFFF'>"; //한줄 그린다.
for($col = 1;$col<=7;$col++) //한주가 7일이니깐 7번 돈다.
{
if($row==1) //요일을 넣기위한 칸^^
{
echo "<td height=30 width=14.2857% align=center><font face='arial black'>";
echo "<font color=black>";
if ($col==1) echo "<font color=red>";
if ($col==7) echo "<font color=blue>";
echo "<h4>$yoil[$col]</h></font><br>";
}else{
$cur++; //공백까지 포함해서 1씩 증가하는데, 일자를 출력할땐 공백의 갯수 뺀다.
if (($cur<=$curFw) || ($cur > ($curMaxday+$curFw)) == true)
{
echo "<td valign=top> ";
}else{
if (($cur-$curFw)==$curD)//오늘일자 하이라이트.
{
echo "<td valign=top bgcolor=#6699CC>"; //한칸 그리고
}else{
echo "<td valign=top>"; //한칸 그리고
}
//일자 표시 부분... 각각 테이블이 들어간다. 디자인을 위해서..
echo "<table border=0 height=10 width=100% height=100% bgcolor=EEEEEE cellspacing=0 cellpadding=0><tr><td align=right>";
echo "<font color=black>";
if ($col==1) echo "<font color=red>";
if ($col==7) echo "<font color=blue>";
echo $cur-$curFw;
echo "</font> </td></tr></table>";
}
}
echo "</td>";
}
echo "</tr>";
}
}
echo "</table>";
?>
댓글 2
제목 | 글쓴이 | 날짜 |
---|---|---|
상태바에 링크 주소 99.9% 가리기 - 다른것 [8] | 세죠위그이 | 2003.05.05 |
상태바에 링크 주소 쉽게 99.9999% 가리기 [8] | 최상락 | 2003.05.03 |
또다른 TOP으로 가기 [6] | RedEye | 2003.05.05 |
시디롬 뱉어 내는 스크립.. [2] | 피너츠 | 2003.04.29 |
[! 수정판 !] 일반 자바 스크릅트와 차원이 다른 VB 스크립트 만들기! [10] | 제로보드 | 2003.04.29 |
숫자인지 아닌지 알아보는함수 [1] | 김승태 | 2003.04.27 |
좌표관련메소드모음 [1] | 김승태 | 2003.04.27 |
유용한건 아니지만 마우스 클릭으로 블루스크린띠우기 [3] | 루룿 | 2003.04.25 |
png-24 포맷 알파값 이미지 로딩하기 [9] | D3 | 2003.04.20 |
메뉴이동입니다. [5] | 데빌스텔스 | 2003.04.20 |
간단한 점프메뉴(selecter) [14] | 박재현 | 2003.04.14 |
페이지 프린트 제어 하기 [1] | RedEye | 2003.04.14 |
부라우저 타이틀 제어? [1] | RedEye | 2003.04.14 |
현재 데이터를 읽는 중입니다. 잠시만 기다려주세요~!! | RedEye | 2003.04.12 |
두드려라! 그러면 돌아갈 것이다~ [3] | RedEye | 2003.04.12 |
001 ~ 999 순차적인 리스트 만들기 [8] | 아이쿠 | 2003.04.10 |
현재 접속 시간을 택스트로 뿌려주는 소스... [8] | 이태운 | 2003.04.04 |
Pop-up Window 생성기 [1] | xcool | 2003.04.03 |
프레임에서 버튼으로 타겟 지정하기!! [1] | RedEye | 2003.04.01 |
엔지오식 좌측이동메뉴 레이어 가운데기준정렬 [11] | 스티치 | 2003.03.29 |
달력은 date, mktime 함수가 매우 중요하죠.
특히 mktime 함수 몰랐을때는 달력 엄두도 안났었네요.