혹시 간단한 달력 소스 하나 만들어줄수있나요 ?..
본문
진짜 달력처럼 말고 그냥 이번달 1~30 까지 숫자로 그냥 출력 되게끔 ....ㅜ_ㅜ..
답변 4
<?php
if(!$year_cal)
{
$year_cal = date("Y");
}
if(!$month_cal)
{
$month_cal = date("m");
}
if(!$day_cal)
{
$day_cal = date("j");
}
$next_year = date("Y",strtotime($year_cal."-".$month_cal."-".$day_cal."+1 year"));
$prev_year = date("Y",strtotime($year_cal."-".$month_cal."-".$day_cal."-1 year"));
$time = strtotime($year_cal.'-'.$month_cal.'-01');
list($tday, $sweek) = explode('-', date('t-w', $time)); // 총 일수, 시작요일
$tweek = ceil(($tday + $sweek) / 7); // 총 주차
$lweek = date('w', strtotime($year_cal.'-'.$month_cal.'-'.$tday)); // 마지막요일
$holiday_array = array //2013년 휴일
(
"1"=>array("1"=>"신정", "22"=>"구정", "23"=>"구정", "24"=>"구정"),
"2"=>array(),
"3"=>array("1"=>"삼일절"),
"4"=>array("5"=>"식목일"),
"5"=>array("5"=>"어린이날", "28"=>"석가탄신일"),
"6"=>array("6"=>"현충일"),
"7"=>array(),
"8"=>array("15"=>"광복절"),
"9"=>array("29"=>"추석", "30"=>"추석"),
"10"=>array("1"=>"추석", "3"=>"개천절"),
"11"=>array(),
"12"=>array("25"=>"성탄절")
);
?>
<html>
<head><title>::달력::</title>
<link rel="stylesheet" type="text/css" href="../bbs_file/style.css">
</head>
<body topmargin=0>
<table cellpadding=0 cellspacing=0 width="90%" align=center border=0 height="100%">
<tr><td>
<!--제목-->
<table cellpadding=5 cellspacing=0 width="100%" align=center height="100%">
<tr>
<td align=center><font style="text-decoration:none;font-size:12px;font-weight:bold"><?=$year_cal?>년 <?=$month_cal?>월</font></td>
</tr>
</table>
</td></tr>
<tr height=2><td></td></tr>
<tr><td>
<!--내용-->
<table width='100%' cellpadding='3' cellspacing='1' border='0' align=center height="100%">
<tr>
<th align=center bgcolor="#7abae4">일</th>
<th align=center bgcolor="#7abae4">월</th>
<th align=center bgcolor="#7abae4">화</th>
<th align=center bgcolor="#7abae4">수</th>
<th align=center bgcolor="#7abae4">목</th>
<th align=center bgcolor="#7abae4">금</th>
<th align=center bgcolor="#7abae4">토</th>
</tr>
<? for ($n=1,$i=0; $i<$tweek; $i++) { ?>
<tr>
<? for ($k=0; $k<7; $k++) { ?>
<td align=center style="border:solid 1px #7abae4">
<?
if ($k =="0") //일요일
{
$color="red";
}
elseif ($k =="6") //토요일
{
$color="blue";
}
else // 평일
{
$color="black";
}
?>
<? if (!(($i == 0 && $k < $sweek) || ($i == $tweek-1 && $k > $lweek))) { ?>
<?
if ($n==date("d")) //오늘
{
$color="orange";
}
?>
<? if($year_cal==2012 && $holiday_array[(int)$month_cal][$n]) $color=red; ?>
<font color="<?=$color?>"><?=$n?></font>
<?
$n++
?>
<? } //if?>
<br><!--td채우기-->
</td>
<? } //for?>
</tr>
<? } //for?>
</table>
</td></tr>
</table>
</body>
</html>
웹 상에 공개되어 있는것인데 참고하세요.
!-->제작의뢰로 .... ㅋㅋㅋㅋ - 3-;; 죄송
익명닉네임께 부탁 하면 하나 뚝딱 만들어 주십니다. 응?
답변을 작성하시기 전에 로그인 해주세요.