3
2026. 3
😊 좋음

썰타래 게시판 갱신 시 어디에 최신글 달렸는지 표시

1. list.tarae.skin.php 에서 실제로 화면에 글을 뿌려주는 반복문 안에 최신글 여부 확인 로직 추가

<?php if (count($list) > 0) { ?>

<div class="log20_list_tarae_area" id="log20_list_tarae_area">
<?php foreach ($list as $item) {
// 1. 현재 루프 중인 글의 ID 정의 (Warning 방지)
$item_id = (int)$item['wr_id'];

// 2. 최신 타래 여부 확인 로직
$is_new_tarae = false;
$new_limit_hours = 24; // 24~48시간 중 설정 가능

if (isset($tarae_threads[$item_id]) && !empty($tarae_threads[$item_id])) {
// 상단에서 정리된 타래 배열 중 마지막 글(최신글)을 확인
$last_thread = end($tarae_threads[$item_id]);
reset($tarae_threads[$item_id]); // 포인터 초기화

$last_thread_time = strtotime($last_thread['wr_datetime']);
if (G5_SERVER_TIME - $last_thread_time < $new_limit_hours * 3600) {
$is_new_tarae = true;
}
}

// 나머지 출력용 변수들
$content_id = 'tarae_content_' . $item_id;
// ... (기존 코드들) ...
?>


2. $is_new_tarae = true 일 때 새글 표시 하도록 각 타래 머리글 새로고침 버튼 뒤에 삼항 연산자 추가

<div class="log20_tarae_footer">

// 새로고침 아이콘 뒤에 추가
<?php echo ($is_new_tarae) ? '<span class="tarae_new_badge" title="최신 타래 등록" style="display: inline-block; font-size: 12px; color: #e91e63; margin-left: 5px; font-weight: bold;">New!</span>' : ''; ?>
</div>
텍스트 편집