고정 공지 관리페이지 정보
최신글 고정 공지 관리페이지
첨부파일
테스트한 버전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
8
댓글 전체

감사 합니다.

감사합니다 ^^

감사합니다
감사합니다.^^
유용한 자료네요 감사합니다.

감사합니다.