고정 공지 관리페이지 > 그누보드5 스킨

🙏SIR UI/UX 디자인 의뢰(~7/31)

그누보드5 스킨

좋은 댓글과 좋아요는 제작자에게 큰힘이 됩니다.

고정 공지 관리페이지 정보

최신글 고정 공지 관리페이지

첨부파일

고정 공지.zip (6.5K) 9회 다운로드 2025-05-17 16:36:01
테스트한 버전5.6.13

본문

스마트폰 약정 연장 한달전에 안내

도메인 결제등  안내

 

첨부파일은 관리자 페이지에 업로드하세요 

 

관리자 페이지에서 보면 좋을듯 싶어서 만들었습니다.

adm/admin.menu100.php 추가


    array('100320', '고정공지관리', G5_ADMIN_URL . '/tnlist.php', 'scf_poplayer'),

아무나 업그레이드 해서 배포하세요 ;;;

 

노출 페이지 코드입니다.


   
<?php
$year = date("Y"); // 예: 2025
$today = date("Y-m-d"); // 오늘 날짜
$month_end = date("m-d", strtotime("+1 month"));// 오늘 기준 한 달 후 날짜 (1달 뒤)
$week_end = date("m-d", strtotime("+1 week"));// 오늘 기준 일주일 후 날짜 (7일 뒤)
$today_md = date("m-d");// 오늘 날짜 (월-일)
$sql = " SELECT * FROM g5_top_notice WHERE (tn_month = $year AND tn_md BETWEEN '$today_md' AND '$month_end')
    OR (tn_week = $year AND tn_md BETWEEN '$today_md' AND '$week_end')";
$result = sql_query($sql);
if (mysqli_num_rows($result) > 0) {
    $notices = [];
    while ($row = mysqli_fetch_assoc($result)) {
         $notices[] = [
        'subject' => htmlspecialchars($row['tn_subject']),
        'week' => $row['tn_month'],
        'id' => $row['tn_id'],
        ];
    }
} else {
    echo "<p>해당 기간의 공지가 없습니다.</p>";
}
$jsonData = json_encode($notices);
?>
<div id="notice-container"></div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
    let notices = <?php echo $jsonData; ?>;
    let index = 0;
    let container = $("#notice-container");
    function updateNotice() {
        container.empty();
        let notice = notices[index];
        let div = $("<div>").addClass("notice").css("top", "0px")
            .html(`<strong>${notice.subject}</strong> (연도: ${notice.week})`)
            .attr("data-id", notice.id)
            .click(function () {
                let noticeId = $(this).attr("data-id");
                
                $.ajax({
                    url: "tnviewupdate.php",
                    type: "POST",
                    data: { id: noticeId },
                    dataType: "json", // JSON 데이터로 받음
                    success: function (response) {
                        console.log(response); // 응답값 확인
                        if (response.status === "success") {
                            $(div).html(`<strong>${notice.subject}</strong> (연도 변경됨: ${response.newYear})`);
                        }
                        else {
                            alert("오류 발생: " + response.message);
                        }
                    },
                    error: function () {
                        alert("연도 변경 중 오류가 발생했습니다.");
                    }
                });
            });
        container.append(div);
        index = (index + 1) % notices.length;
    }
    updateNotice();
    setInterval(updateNotice, 2000);    
</script>

 

공지 클릭하면 확인했다는 뜻으로 고정공지에서 내려옵니다.

 

추천
8

댓글 전체

전체 2,678 |RSS
그누보드5 스킨 내용 검색

회원로그인

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