최근게시물 달력... > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

최근게시물 달력... 정보

최근게시물 달력...

본문

최근게시물 달력인데요

이게 달을 전,후로 바꾸면..

페이지가 메뉴로 전환이 되네요..

달력은 그대로 1월로 남아 있구요

머가 문제일까요?

url : www.masoteam.com 오른쪽에 달력입니다.

댓글 전체

탑빌더를 사용하신것 같은데
오른쪽 달력 소스를 봐야 해결이 가능할 것 같네요.
일단 bo_table이라는 변수와 날짜를 변수로 날려서 월을 이동하는걸로 여겨지는데
탑빌더 메뉴상에서 해당 bo_table 때문에 메뉴가 표시되는 것 같습니다.

달력을 불러오는 소스에서  bo_table대신 다른변수명(예를 들어 bo_table2) 정도를 사용하시면 될 것 같은데
(탑빌더 기본으로 스케쥴러가 내장 되어 있나요? 만약 그렇다면 탑빌더 사이트에서 물어보시는게 좋을 것 같습니다.)
해당 소스 입니다. 그리고 탑빌더 맞구요

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// 일정(스케쥴) 스킨
// 게시판의 wr_1 필드에 날짜 형식 20081216 일과 같은 yyyymmdd 형식으로 저장
?>

<style>
#schedule_latest .sc_ym  { font: bold 12px "Trebuchet MS"; text-align:center; height:20px; }
#schedule_latest .sc_tit { font: normal 12px Gulim; text-align:center; height:20px; }
#schedule_latest .sc_sun { color:#ff0000; }
#schedule_latest .sc_sat { color:#0000ff; }
#schedule_latest .sc_day { font: normal 11px "Helvetica Neue"; text-align:center; height:20px; }
#schedule_latest .sc_day a { font: bold 11px "Helvetica Neue"; color:#009900; }
#schedule_latest .sc_today a { text-decoration: underline; }
</style>

<table width=100% border=0 id="schedule_latest">
<?
if (!function_exists("get_first_day")) {
    // 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 get_first_day($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;
    }
}

// 오늘
$today = getdate($g4[server_time]);

$year  = (int)substr($schedule_ym, 0, 4);
$month = (int)substr($schedule_ym, 4, 2);
if ($year  < 1)                $year  = $today[year];
if ($month < 1 || $month > 12) $month = $today[mon];
$current_ym = sprintf("%04d%02d", $year, $month);

$end_day = array(1=>31, 28, 31, 30 , 31, 30, 31, 31, 30 ,31 ,30, 31);
// 윤년 계산 부분이다. 4년에 한번꼴로 2월이 28일이 아닌 29일이 있다.
if( $year%4 == 0 && $year%100 != 0 || $year%400 == 0 )
    $end_day[2] = 29; // 조건에 적합할 경우 28을 29로 변경

// 해당월의 1일을 mktime으로 변경
$mktime = mktime(0,0,0,$month,1,$year);
$mkdate = getdate(strtotime(date("Y-m-1", $mktime)));

// 1일의 첫번째 요일 (0:일, 1:월 ... 6:토)
$first_day = get_first_day($year, $month);
// 해당월의 마지막 날짜,
$last_day  = $end_day[$month];

if ($month - 1 < 1) {
    $before_ym = sprintf("%04d%02d", ($year-1), 12);
} else {
    $before_ym = sprintf("%04d%02d", $year, ($month-1));
}

if ($month + 1 > 12) {
    $after_ym  = sprintf("%04d%02d", ($year+1), 1);
} else {
    $after_ym  = sprintf("%04d%02d", $year, ($month+1));
}

// 최신글과 게시판의 스킨폴더명이 동일해야 함
echo "<tr><td colspan='7' align='right' style='font:normal 10px tahoma; padding-right:5px;'>";
echo "<a href='$g4[bbs_path]/board.php?bo_table=tb85&cate_id=a060'>more</a></td></tr>";
echo "<tr>";
echo "<td align='center'><a href='$_SERVER[PHP_SELF]?bo_table=$bo_table&schedule_ym=$before_ym'><img src='$latest_skin_path/img/month_prev.gif' border='0'></a></td>";
echo "<td colspan='5' align='center' class='sc_ym'>";
echo " $year / $month ";
echo "</td>";
echo "<td align='center'><a href='$_SERVER[PHP_SELF]?bo_table=$bo_table&schedule_ym=$after_ym'><img src='$latest_skin_path/img/month_next.gif' border='0'></a></td>";
echo "</tr>";

// 요일
$yoil = array ("일", "월", "화", "수", "목", "금", "토");
echo "<tr>";
for ($i=0; $i<7; $i++) {
    $class = array();
    $class[] = "sc_tit";
    if ($i == 0)
        $class[] = "sc_sun";
    else if ($i == 6)
        $class[] = "sc_sat";
    $class_list = implode(" ", $class);
    echo "<td class='$class_list'>$yoil[$i]</td>";
}
echo "</tr>";

$cnt = $day = 0;
for ($i=0; $i<6; $i++) {
    echo "<tr>";
    for ($k=0; $k<7; $k++) {
        $cnt++;
        echo "<td class='sc_day'>";
        if ($cnt > $first_day) {
            $day++;
            if ($day <= $last_day) {

                $class = array();

                // 오늘이라면
                if ($today[year] == $year && $today[mon] == $month && $today[mday] == $day) {
                    $class[] = "sc_today";
                }

                $current_ymd = $current_ym . sprintf("%02d", $day);

                if ($k == 0)
                    $class[] = "sc_sun";
                else if ($k == 6)
                    $class[] = "sc_sat";

                $class_list = implode(" ", $class);
                echo "<span class='$class_list'>";

                $sql = " select count(*) as cnt from $g4[write_prefix]$bo_table where wr_1 = '$current_ymd' and wr_is_comment = 0 ";
                $row = sql_fetch($sql);
                if ($row[cnt]) {
                    echo "<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&sfl=wr_1&stx=$current_ymd');\" title='일정건수 : {$row[cnt]}건'>";
                    echo $day;
                    echo "</a>";
                } else {
                    echo $day;
                }
                echo "</span>";
            } else {
                echo "&nbsp;";
            }
        } else {
            echo "&nbsp;";
        }
        echo "</td>";
    }
    echo "</tr>\n";
    if ($day >= $last_day)
        break;
}

?>
</table>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// 일정(스케쥴) 스킨
// 게시판의 wr_1 필드에 날짜 형식 20081216 일과 같은 yyyymmdd 형식으로 저장
if(!$schedule_ym) $schedule_ym = $_GET['schedule_ym'];
?>

<style>
#schedule_latest .sc_ym  { font: bold 12px "Trebuchet MS"; text-align:center; height:20px; }
#schedule_latest .sc_tit { font: normal 12px Gulim; text-align:center; height:20px; }
#schedule_latest .sc_sun { color:#ff0000; }
#schedule_latest .sc_sat { color:#0000ff; }
#schedule_latest .sc_day { font: normal 11px "Helvetica Neue"; text-align:center; height:20px; }
#schedule_latest .sc_day a { font: bold 11px "Helvetica Neue"; color:#009900; }
#schedule_latest .sc_today a { text-decoration: underline; }
</style>

<table width=100% border=0 id="schedule_latest">
<?
if (!function_exists("get_first_day")) {
    // 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 get_first_day($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;
    }
}

// 오늘
$today = getdate($g4[server_time]);

$year  = (int)substr($schedule_ym, 0, 4);
$month = (int)substr($schedule_ym, 4, 2);
if ($year  < 1)                $year  = $today[year];
if ($month < 1 || $month > 12) $month = $today[mon];
$current_ym = sprintf("%04d%02d", $year, $month);

$end_day = array(1=>31, 28, 31, 30 , 31, 30, 31, 31, 30 ,31 ,30, 31);
// 윤년 계산 부분이다. 4년에 한번꼴로 2월이 28일이 아닌 29일이 있다.
if( $year%4 == 0 && $year%100 != 0 || $year%400 == 0 )
    $end_day[2] = 29; // 조건에 적합할 경우 28을 29로 변경

// 해당월의 1일을 mktime으로 변경
$mktime = mktime(0,0,0,$month,1,$year);
$mkdate = getdate(strtotime(date("Y-m-1", $mktime)));

// 1일의 첫번째 요일 (0:일, 1:월 ... 6:토)
$first_day = get_first_day($year, $month);
// 해당월의 마지막 날짜,
$last_day  = $end_day[$month];

if ($month - 1 < 1) {
    $before_ym = sprintf("%04d%02d", ($year-1), 12);
} else {
    $before_ym = sprintf("%04d%02d", $year, ($month-1));
}

if ($month + 1 > 12) {
    $after_ym  = sprintf("%04d%02d", ($year+1), 1);
} else {
    $after_ym  = sprintf("%04d%02d", $year, ($month+1));
}

// 최신글과 게시판의 스킨폴더명이 동일해야 함
echo "<tr><td colspan='7' align='right' style='font:normal 10px tahoma; padding-right:5px;'>";
echo "<a href='$g4[bbs_path]/board.php?bo_table=tb85&cate_id=a060'>more</a></td></tr>";
echo "<tr>";
echo "<td align='center'><a href='$_SERVER[PHP_SELF]?bo_table2=$bo_table&schedule_ym=$before_ym'><img src='$latest_skin_path/img/month_prev.gif' border='0'></a></td>";
echo "<td colspan='5' align='center' class='sc_ym'>";
echo " $year / $month ";
echo "</td>";
echo "<td align='center'><a href='$_SERVER[PHP_SELF]?bo_table2=$bo_table&schedule_ym=$after_ym'><img src='$latest_skin_path/img/month_next.gif' border='0'></a></td>";
echo "</tr>";

// 요일
$yoil = array ("일", "월", "화", "수", "목", "금", "토");
echo "<tr>";
for ($i=0; $i<7; $i++) {
    $class = array();
    $class[] = "sc_tit";
    if ($i == 0)
        $class[] = "sc_sun";
    else if ($i == 6)
        $class[] = "sc_sat";
    $class_list = implode(" ", $class);
    echo "<td class='$class_list'>$yoil[$i]</td>";
}
echo "</tr>";

$cnt = $day = 0;
for ($i=0; $i<6; $i++) {
    echo "<tr>";
    for ($k=0; $k<7; $k++) {
        $cnt++;
        echo "<td class='sc_day'>";
        if ($cnt > $first_day) {
            $day++;
            if ($day <= $last_day) {

                $class = array();

                // 오늘이라면
                if ($today[year] == $year && $today[mon] == $month && $today[mday] == $day) {
                    $class[] = "sc_today";
                }

                $current_ymd = $current_ym . sprintf("%02d", $day);

                if ($k == 0)
                    $class[] = "sc_sun";
                else if ($k == 6)
                    $class[] = "sc_sat";

                $class_list = implode(" ", $class);
                echo "<span class='$class_list'>";

                $sql = " select count(*) as cnt from $g4[write_prefix]$bo_table2 where wr_1 = '$current_ymd' and wr_is_comment = 0 ";
                $row = sql_fetch($sql);
                if ($row[cnt]) {
                    echo "<a href='$g4[bbs_path]/board.php?bo_table=$bo_table2&sfl=wr_1&stx=$current_ymd');\" title='일정건수 : {$row[cnt]}건'>";
                    echo $day;
                    echo "</a>";
                } else {
                    echo $day;
                }
                echo "</span>";
            } else {
                echo "&nbsp;";
            }
        } else {
            echo "&nbsp;";
        }
        echo "</td>";
    }
    echo "</tr>\n";
    if ($day >= $last_day)
        break;
}

?>
</table>
전체 2 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT