달력게시판에서 여분필드 사용하기 정보
달력게시판에서 여분필드 사용하기본문
안녕하세요, 그누에서 많은것을 배우고 있는 웹디자이너 입니다^^
다름이 아니고 저희 회사 달력게시판을 고마운 다른 회원분이 올리신 스킨
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=87703&sca=%B4%DE%B7%C2
으로 쓰고 있는데요,
지금 일정을 넣으면 모두 날짜가 빨갛게 변해버려서
휴일에만 빨간색, 영업일은 파란색으로 바꾸려고 합니다.
그래서 각 스킨페이지에 wr_2 여분필드를 주게 되었는데요...
1) write.skin.php 페이지
<td class="title">휴일여부</td>
<td class="field"><input type="radio" name="wr_2" id="0" value="0"><label for="0">휴일</label> <input type="radio" name="wr_2" id="1" value="1"><label for="1">영업일</label></td>
이렇게 주었구요
wr_2 가 0이면 휴일, 1이면 영업일 입니다.
그런데 list.skin.php에서 나타나질 않네요...
2) list.skin.php 페이지
if($schedule) {
if($list[$i][wr_2] == 0){
$date = "<strong class=\"red\">{$date}</strong>";
}else if($list[$i][wr_2] == 1){
$date = "<strong class=\"blue\">{$date}</strong>";
}
}
echo "<td class=\"default\"><div>{$date}</div>{$schedule}</td>";
이렇게 했거든요.. if를 안주고 $date = "<strong class=\"blue\">{$date}</strong>"; 만 주면 파란색 글씨로 잘 뜨구요..
근데 제가 뭘 잘못했는지 저 if~else 문이 통 먹지를 않네요 ㅠ_-
다음은 list.skin.php 페이지 전문입니다.
<?php
include_once($board_skin_path . '/lib/skin.lib.php');
$VAR['today'] = date('Ymd');
$VAR['select'] = date('Ym');
if(preg_match('/^[0-9]{6}$/', $_GET['schedule_ym']) == true && checkdate(substr($_GET['schedule_ym'], 4, 2), 1, substr($_GET['schedule_ym'], 0, 4)) == true) $VAR['select'] = $_GET['schedule_ym'];
$VAR['timestamp'] = strtotime($VAR['select'] . '01');
$VAR['weekday'] = date('w', $VAR['timestamp']);
$VAR['count'] = date('t', $VAR['timestamp']) + $VAR['weekday'] + 1;
$VAR['path'] = "{$g4['bbs_path']}/board.php?bo_table={$bo_table}";
?>
<link rel="stylesheet" type="text/css" href="<?php echo $board_skin_path; ?>/css/list.skin.css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/list.skin.js" charset="<?php echo $g4['charset']; ?>"></script>
<center id="G4_LIST" style="width:<?php echo $width; ?>;">
<p class="subject">
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('-1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_prev_month.gif" alt="이전달" /></a>
<a href="<?php echo $VAR['path'] . "&schedule_ym={$VAR['select']}"; ?>"><strong><?php echo date('Y년 m월', $VAR['timestamp']); ?></strong></a>
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('+1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_next_month.gif" alt="다음달" /></a>
</p>
<table>
<tr>
<td class="sunday"><strong class="white">일</strong></td>
<td class="weekday"><strong class="white">월</strong></td>
<td class="weekday"><strong class="white">화</strong></td>
<td class="weekday"><strong class="white">수</strong></td>
<td class="weekday"><strong class="white">목</strong></td>
<td class="weekday"><strong class="white">금</strong></td>
<td class="saturday"><strong class="white">토</strong></td>
</tr>
<tr>
<?php
for($i = $row = 1; $i < $VAR['count']; $i++, $row++)
{
$date = $i - $VAR['weekday'];
if($date < 1) echo '<td class="default"> </td>';
else
{
$wr_1 = $VAR['select'] . sprintf('%02d', $date);
if($VAR['today'] == $wr_1) $date = "<ins>{$date}</ins>";
$schedule = null;
$query = sql_query("SELECT wr_id, wr_subject FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_is_comment = 0");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}\">{$result['wr_subject']}</a></div>";
}
if($schedule) {
if($list[$i][wr_2] == 0){
$date = "<strong class=\"red\">{$date}</strong>";
}else if($list[$i][wr_2] == 1){
$date = "<strong class=\"blue\">{$date}</strong>";
}
}
echo "<td class=\"default\"><div>{$date}</div>{$schedule}</td>";
}
if($row > 0 && $row % 7 == 0 && $row < $VAR['count']) echo '</tr><tr height="100">';
}
$count = 7 - (($row - 1) % 7);
if($count != 7)
{
for($i = 1; $i <= $count; $i++) echo '<td class="default"> </td>';
}
?>
</tr>
</table>
<?php if($admin_href || !$member['mb_id'] || $write_href){ ?>
<p class="button">
<?php if($admin_href) echo "<input type=\"button\" name=\"write\" value=\"관리자\" class=\"root\" onclick=\"window.document.location.href='{$admin_href}';\" />"; ?>
<?php if(!$member['mb_id']) echo "<input type=\"button\" name=\"write\" value=\"로그인\" class=\"button\" onclick=\"window.document.location.href='{$g4['bbs_path']}/login.php?url={$urlencode}';\" />"; ?>
<?php if($write_href) echo "<input type=\"button\" name=\"write\" value=\"작성\" class=\"button\" onclick=\"window.document.location.href='{$write_href}';\" />"; ?>
</p>
<?php } ?>
</center>
그누분들의 도움이 필요합니다~
다름이 아니고 저희 회사 달력게시판을 고마운 다른 회원분이 올리신 스킨
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=87703&sca=%B4%DE%B7%C2
으로 쓰고 있는데요,
지금 일정을 넣으면 모두 날짜가 빨갛게 변해버려서
휴일에만 빨간색, 영업일은 파란색으로 바꾸려고 합니다.
그래서 각 스킨페이지에 wr_2 여분필드를 주게 되었는데요...
1) write.skin.php 페이지
<td class="title">휴일여부</td>
<td class="field"><input type="radio" name="wr_2" id="0" value="0"><label for="0">휴일</label> <input type="radio" name="wr_2" id="1" value="1"><label for="1">영업일</label></td>
이렇게 주었구요
wr_2 가 0이면 휴일, 1이면 영업일 입니다.
그런데 list.skin.php에서 나타나질 않네요...
2) list.skin.php 페이지
if($schedule) {
if($list[$i][wr_2] == 0){
$date = "<strong class=\"red\">{$date}</strong>";
}else if($list[$i][wr_2] == 1){
$date = "<strong class=\"blue\">{$date}</strong>";
}
}
echo "<td class=\"default\"><div>{$date}</div>{$schedule}</td>";
이렇게 했거든요.. if를 안주고 $date = "<strong class=\"blue\">{$date}</strong>"; 만 주면 파란색 글씨로 잘 뜨구요..
근데 제가 뭘 잘못했는지 저 if~else 문이 통 먹지를 않네요 ㅠ_-
다음은 list.skin.php 페이지 전문입니다.
<?php
include_once($board_skin_path . '/lib/skin.lib.php');
$VAR['today'] = date('Ymd');
$VAR['select'] = date('Ym');
if(preg_match('/^[0-9]{6}$/', $_GET['schedule_ym']) == true && checkdate(substr($_GET['schedule_ym'], 4, 2), 1, substr($_GET['schedule_ym'], 0, 4)) == true) $VAR['select'] = $_GET['schedule_ym'];
$VAR['timestamp'] = strtotime($VAR['select'] . '01');
$VAR['weekday'] = date('w', $VAR['timestamp']);
$VAR['count'] = date('t', $VAR['timestamp']) + $VAR['weekday'] + 1;
$VAR['path'] = "{$g4['bbs_path']}/board.php?bo_table={$bo_table}";
?>
<link rel="stylesheet" type="text/css" href="<?php echo $board_skin_path; ?>/css/list.skin.css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/list.skin.js" charset="<?php echo $g4['charset']; ?>"></script>
<center id="G4_LIST" style="width:<?php echo $width; ?>;">
<p class="subject">
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('-1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_prev_month.gif" alt="이전달" /></a>
<a href="<?php echo $VAR['path'] . "&schedule_ym={$VAR['select']}"; ?>"><strong><?php echo date('Y년 m월', $VAR['timestamp']); ?></strong></a>
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('+1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_next_month.gif" alt="다음달" /></a>
</p>
<table>
<tr>
<td class="sunday"><strong class="white">일</strong></td>
<td class="weekday"><strong class="white">월</strong></td>
<td class="weekday"><strong class="white">화</strong></td>
<td class="weekday"><strong class="white">수</strong></td>
<td class="weekday"><strong class="white">목</strong></td>
<td class="weekday"><strong class="white">금</strong></td>
<td class="saturday"><strong class="white">토</strong></td>
</tr>
<tr>
<?php
for($i = $row = 1; $i < $VAR['count']; $i++, $row++)
{
$date = $i - $VAR['weekday'];
if($date < 1) echo '<td class="default"> </td>';
else
{
$wr_1 = $VAR['select'] . sprintf('%02d', $date);
if($VAR['today'] == $wr_1) $date = "<ins>{$date}</ins>";
$schedule = null;
$query = sql_query("SELECT wr_id, wr_subject FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_is_comment = 0");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}\">{$result['wr_subject']}</a></div>";
}
if($schedule) {
if($list[$i][wr_2] == 0){
$date = "<strong class=\"red\">{$date}</strong>";
}else if($list[$i][wr_2] == 1){
$date = "<strong class=\"blue\">{$date}</strong>";
}
}
echo "<td class=\"default\"><div>{$date}</div>{$schedule}</td>";
}
if($row > 0 && $row % 7 == 0 && $row < $VAR['count']) echo '</tr><tr height="100">';
}
$count = 7 - (($row - 1) % 7);
if($count != 7)
{
for($i = 1; $i <= $count; $i++) echo '<td class="default"> </td>';
}
?>
</tr>
</table>
<?php if($admin_href || !$member['mb_id'] || $write_href){ ?>
<p class="button">
<?php if($admin_href) echo "<input type=\"button\" name=\"write\" value=\"관리자\" class=\"root\" onclick=\"window.document.location.href='{$admin_href}';\" />"; ?>
<?php if(!$member['mb_id']) echo "<input type=\"button\" name=\"write\" value=\"로그인\" class=\"button\" onclick=\"window.document.location.href='{$g4['bbs_path']}/login.php?url={$urlencode}';\" />"; ?>
<?php if($write_href) echo "<input type=\"button\" name=\"write\" value=\"작성\" class=\"button\" onclick=\"window.document.location.href='{$write_href}';\" />"; ?>
</p>
<?php } ?>
</center>
그누분들의 도움이 필요합니다~
댓글 전체
wr_2값 제대로 들어갔는지 wr_2출력해보세요...이프문 잘못된거 없는거 같으니깐여~
이 스킨은 보통 그누게시판이랑 틀리게 list.skin.php 에서 따로 여분필드를 DB에서 불러와야 하더군요.. OTL 아는 프로그래머분에게 부탁해서 해결했어요. 답변 감사합니다.
(그런데 포인트는 수정이 안되더군여ㅠ 포인트가 어느정도가 적정한지를 몰라서..답변 감사합니다.)
(그런데 포인트는 수정이 안되더군여ㅠ 포인트가 어느정도가 적정한지를 몰라서..답변 감사합니다.)