최신글 달력 링크 문제로 질문 드립니다. 채택완료
안녕하세요
제가 최신글 달력 스킨으로 작업중인데, 지금 사용한 달력 스킨 이 팝업으로 내용이 뜨게 되어있어서
일정을 클릭하면 해당 게시물로 이동하게끔 수정하려고 합니다.
소스를 이것저것 고쳐봤는데, 잘 되지 않아 문의 드립니다.
소스는 아래에 첨부드리니, 아시는 분은 답변 좀 부탁드릴게요~ 감사합니다.
========================================================
<?
global $is_admin;
// 글자 색상
$weekday_color = "#4a4a4a"; // 평일
$saturday_color = "#0076da"; // 토요일
$sunday_color = "#f00000"; // 일요일 (공휴일)
// 배경 색상
$title_bgcolor = "#F6F6F6";
$today_bgcolor = "yellow"; // 오늘
$select_bgcolor = "#BAFFF6"; // 선택일
$dlfwjd = "#99CCFF";//일정배경색
// 요일
$yoil = array ("일", "월", "화", "수", "목", "금", "토");
// mktime() 함수는 1970 ~ 2038년까지만 계산되므로 사용하지 않음
// 참고 : http://phpschool.com/bbs2/inc_view.html?id=3924&code=tnt2&start=0&mode=search&s_que=mktime&field=title&operator=and&period=all
function spacer($year, $month)
{
$day = 1;
$spacer = array(0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4);
$year = $year - ($month < 3);
$result = ($year + (int) ($year/4) - (int) ($year/100) + (int) ($year/400) + $spacer[$month-1] + $day) % 7;
return $result;
}
$yyyy = $_REQUEST[yyyy];
$mm = $_REQUEST[mm];
// 오늘
$today = getdate($g4[server_time]);
$mon = substr("0".$today[mon],-2);
$mday = substr("0".$today[mday],-2);
if (!$yyyy) $yyyy = $today['year'];
if (!$mm) $mm = $today['mon'];
$yyyy = (int)$yyyy;
$mm = (int)$mm;
$f = @file("$g4[path]/bbs/calendar/$yyyy.txt");
if ($f) {
while ($line = each($f)) {
$tmp = explode("|", $line[value]);
$nal[$tmp[0]] = $tmp;
//print_r2($nal);
}
}
$spacer = spacer($yyyy, $mm);
$endday = array(1=>31, 28, 31, 30 , 31, 30, 31, 31, 30 ,31 ,30, 31);
// 윤년 계산 부분이다. 4년에 한번꼴로 2월이 28일이 아닌 29일이 있다.
if( $yyyy%4 == 0 && $yyyy%100 != 0 || $yyyy%400 == 0 )
$endday[2] = 29; // 조건에 적합할 경우 28을 29로 변경
// 해당월의 1일
$mktime = mktime(0,0,0,$mm,1,$yyyy);
$dt = getdate(strtotime(date("Y-m-1", $mktime)));
$dt[wday] = $spacer;
// 해당월의 마지막 날짜,
//$last_day = date("t", $mktime);
$last_day = $endday[$mm];
$yyyy_before = $yyyy;
$mm_before = $mm - 1;
if ($mm_before < 1)
{
$yyyy_before--;
$mm_before = 12;
}
$yyyy_after = $yyyy;
$mm_after = $mm + 1;
if ($mm_after > 12)
{
$yyyy_after++;
$mm_after = 1;
}
$yyyy_before_href = "$_SERVER[PHP_SELF]?yyyy=".($yyyy-1)."&mm={$mm}";
$yyyy_after_href = "$_SERVER[PHP_SELF]?yyyy=".($yyyy+1)."&mm={$mm}";
$mm_after_href = "$_SERVER[PHP_SELF]?yyyy={$yyyy_after}&mm={$mm_after}";
$mm_before_href = "$_SERVER[PHP_SELF]?&yyyy={$yyyy_before}&mm={$mm_before}";
$calcon_href = "{$g4['bbs_path']}/board.php?bo_table=$bo_table&year={$yyyy}&month={$mm}";
$VAR['path'] = "{$g4['bbs_path']}/board.php?bo_table={$bo_table}";
$VAR['select'] = date('Ym');
if(preg_match('/^[0-9]{6}$/', $_GET['select']) == true && checkdate(substr($_GET['select'], 4, 2), 1, substr($_GET['select'], 0, 4)) == true) $VAR['select'] = $_GET['select'];
?>
<!-- Line top start -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center" valign="top" style="padding:0px">
<!-- Line top end -->
<!-- Title start -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" valign="top"><a href='<?=$mm_before_href?>'><img src="<?=$latest_skin_path?>/img/btn_prev.gif" width="22" height="22" border="0" align="absmiddle"></a> <a href="<?=$calcon_href?>"><b><font style='font-family:돋움, Dotum, Tahoma; font-size:23px; color:#6c89a5; margin:0 auto;'><?=$yyyy?>/<?=$mm?></font></b></a> <a href='<?=$mm_after_href?>'><img src="<?=$latest_skin_path?>/img/btn_next.gif" width="22" height="22" border="0" align="absmiddle"></a><? if ($is_admin == "super") { ?><?}?>
</td>
</tr>
<tr><td height="10"></td></tr>
</table>
<!--달력일자 부분 시작-->
<!-- Title end -->
<table width="207" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td valign="top" style="background:url(<?=$latest_skin_path?>/img/day_bg.gif) no-repeat top center; padding-top:5px;" align="center" height="136">
<table width=95% cellpadding=0 cellspacing=0 border=0 >
<tr height="15" align="center">
<td width=14% style="color:<?=$sunday_color?>"><b>일</b></td>
<td width=14% style="color:<?=$weekday_color?>"><b>월</b></td>
<td width=14% style="color:<?=$weekday_color?>"><b>화</b></td>
<td width=14% style="color:<?=$weekday_color?>"><b>수</b></td>
<td width=14% style="color:<?=$weekday_color?>"><b>목</b></td>
<td width=14% style="color:<?=$weekday_color?>"><b>금</b></td>
<td width=14% style="color:<?=$saturday_color?>"><b>토</b></td>
</tr>
<?
$cnt = $day = 0;
// 해당일에 글이 올라와 있는지 확인
$cday = 1;
// $sel_mon = sprintf("%02d",$mon); 다음달 일정 출력오류로 변경
$sel_mon = sprintf("%02d",$mm);
$today_sql = "SELECT * FROM $write_table WHERE left(wr_link1,6) <= '$yyyy$sel_mon' and left(wr_link2,6) >= '$yyyy$sel_mon' ORDER BY wr_id ASC";
//$today_sql = "SELECT * FROM g4_write_"."$bo_table WHERE left(wr_link1,6) <= '$yyyy$sel_mon' and left(wr_link2,6) >= '$yyyy$sel_mon' ORDER BY wr_id ASC";
$result=sql_query($today_sql);
// 포문 돌면서 해당일자 배열에 저장
for ($d=0; $row=sql_fetch_array($result); $d++){
$arry_day=substr($row[wr_link1],6,2);
$arry_name[$arry_day]=substr($row[wr_link1],0,8);
$titals[$arry_day]=$row[wr_subject];
}
for ($i=0; $i<6; $i++)
{
echo "<tr>";
for ($k=0; $k<7; $k++)
{
$cnt++;
echo "<td align=center>";
if ($cnt > $dt[wday])
{
$day++;
if ($day <= $last_day)
{
// 1같은경우 01로 변경
$mm2 = substr("0".$mm,-2);
$day2 = substr("0".$day,-2);
if($arry_name[$day2]){
echo "<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td class='cookie' style='padding:0px;font-size:8pt;line-height:16px; cursor:pointer;' id='id$i$k' align=center title='{$titals[$day2]}' onclick=\"javascript:win_open('$g4[path]/pop_schedule.php?bo_table=$bo_table&year=$yyyy&month=$mm2&day=$day2', 'schedule', 'left=50, top=50, width=300, height=400, scrollbars=1');\">";
}else{
echo "<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td class='cookie' style='padding:0px;font-size:8pt;line-height:16px;' id='id$i$k' align=center title='{$titals[$day2]}' >";
}
// 배열의 값이 있는지 비교하여 글자색 변경
if ($arry_name[$day2]){
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.backgroundColor='$dlfwjd';</script>";
}
echo $day;
if ($arry_name[$day2]){
echo "";
}
echo "</td></tr></table>";
if ($k==0)
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.color='$sunday_color';</script>";
else if ($k==6)
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.color='$saturday_color';</script>";
else
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.color='$weekday_color';</script>";
$tmp_date = $yyyy.substr("0".$mm,-2).substr("0".$day,-2);
$tmp = $mm2."-".$day2;
if ($nal[$tmp])
{
$title = trim($nal[$tmp][1]);
//echo $title;
echo "<script language='JavaScript'>document.getElementById('id$i$k').title='{$title}';</script>";
if (trim($nal[$tmp][2]) == "*")
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.color='$sunday_color';</script>";
}
// 오늘이라면
if ($today[year] == $yyyy && $today[mon] == $mm && $today[mday] == $day)
{
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.backgroundColor='$today_bgcolor';</script>";
echo "<script language='JavaScript'>document.getElementById('id$i$k').title+='[오늘]';</script>";
}
// 선택일(넘어온 값) 이라면
else if ($tmp_date == $cur_date)
{
echo "<script language='JavaScript'>document.getElementById('id$i$k').style.backgroundColor='$select_bgcolor';</script>";
echo "<script language='JavaScript'>document.getElementById('id$i$k').title+='[선택일]';</script>";
}
} else
echo " ";
} else
echo " ";
echo "</td>";
}
echo "</tr>\n";
if ($day >= $last_day)
break;
}
?>
</table>
</td>
</tr>
</table>
<!--달력일자 부분 끝-->
</td>
</tr>
<tr>
<td align="left" valign="top"><!--행사 예정 뽑아오기 시작-->
<?
$new_date = date('Y-m-d',time()); //오늘 날짜
$years = date('Y'); // 2000
$months = date('m'); // 1, 2, 3, ..., 12
$days = date('d'); // 1, 2, 3, ..., 31
$limit = '3';
$today_row = date('Ymd');
$qry = "select * from $write_table where $today_row <= wr_link1 or $today_row <= wr_link2 order by wr_link1 ASC LIMIT 0, $limit";
$result1 = sql_query($qry);
for ($i=0; $row=sql_fetch_array($result1); $i++){
$OID = $row[wr_id];
$SUBJECT = stripslashes($row[wr_subject]);
$SUBJECT = strip_tags($SUBJECT);
$S_Year= substr ($row[wr_link1], 0, 4);
$S_MON = substr ($row[wr_link1], 4, 2);
$S_Date = substr ($row[wr_link1], 6,2);
$E_MON = substr ($row[wr_link2], 4, 2);
$E_Date = substr ($row[wr_link2], 6,2);
echo "<table width=100% cellpadding=0 cellspacing=0><tr><td style='line-height:18px; padding-bottom:10px; padding-top:10px; border-top:#d7d7d7 1px solid;' >";
echo "<a href=\"javascript:win_open('$g4[path]/skin/latest/nhc_calendar/pop_schedule.php?bo_table=$bo_table&year=$year&month=$month&day=$cday', 'schedule', 'left=50, top=50, width=300, height=400, scrollbars=1');\" class=writeday>";
if ($row['is_notice'])
if ($row['wr_link1']==$row['wr_link2'])
echo "<font style='font-family:돋움; color:#4075a7;'><strong>{$S_MON}월 {$S_Date}일~{$E_MON}월 {$E_Date}일</strong></font> <br>$SUBJECT<br>";
else
echo "<font style='font-family:돋움; color:#4075a7;'><strong>{$S_MON}월 {$S_Date}일~{$E_MON}월 {$E_Date}일</strong></font> <br>$SUBJECT";
else
if ($row['wr_link1']==$row['wr_link2'])
echo "<font style='font-family:돋움; color:#4075a7;'><strong>{$S_MON}월 {$S_Date}일</strong></font><br> $SUBJECT <br>";
else
echo "<font style='font-family:돋움; color:#4075a7;'><strong>{$S_MON}월 {$S_Date}일~{$E_MON}월 {$E_Date}일</strong></font> <br>$SUBJECT";
echo "</a>";
echo "</td></tr></table>";
}
?>
<!--행사 예정 뽑아오기 끝--></td>
</tr>
</table>
<!-- Line bottom end -->
답변 1개
너무 길어서 인지 답변이 없네요.
이런것은... 다시 질문해보시오.. 안되시면 그때 의뢰를 하심이
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인