최신글에서 비밀글/멤버공개 여부 표시하기
1. lib/latest.lib.php > latest_all 함수 수정
쿼리할 때 is_secret, is_member 값을 확인하도록 한다
(1) 비밀글 여부 확인: wr_option 값에 'secret'이 포함된 경우 + wr_secret 값이 존재할 경우 -> is_secret = TRUE
(2) 멤버공개 여부 확인: wr_option 값에 'member'이 포함된 경우 -> is_member = TRUE
IF(INSTR(wr_option, 'secret') > 0 AND wr_secret != '', TRUE, FALSE) as is_secret,
IF(INSTR(wr_option, 'member') > 0, TRUE, FALSE) as is_member확인한 값을 전달할 데이터 리스트에도 잘 담아준다
$list[$i] = array(
'wr_id' => $row['wr_id'],
'wr_parent' => $row['wr_parent'],
'wr_comment' => $row['wr_comment'],
'bo_table' => $row['bo_table'],
'bo_subject' => $row['bo_subject'],
'subject' => conv_subject($row['wr_subject'], $subject_len, "…"),
'content' => $content_preview,
'wr_name' => $row['wr_name'],
'name' => $row['wr_name'],
'datetime' => $row['wr_datetime'],
'datetime2' => substr($row['wr_datetime'], 2, 8),
'href' => G5_BBS_URL . '/board.php?bo_table=' . $row['bo_table'] . '&wr_id=' . $row['wr_id'],
'comment_cnt' => $row['wr_comment'] ? '(' . $row['wr_comment'] . ')' : '',
'is_reply' => ($row['wr_reply'] != '') ? true : false,
'reply_depth' => strlen($row['wr_reply']),
'is_secret' => (bool)$row['is_secret'], // 배열에 비밀글 여부 추가
'is_member' => (bool)$row['is_member'] // 배열에 멤버공개 여부 추가
);2. skin/main/latest/basic를 수정
최신글 기본 스킨을 사용할 것이므로 basic 폴더 내 파일을 수정하였음

2-1. latest.skin.php
is_secret, is_member가 true일 때 아이콘을 출력하도록 코드를 추가한다
<?php if ($list[$i]['is_secret']) { ?>
<span class="is_secret"><i class="fa-solid fa-lock"></i></span>
<?php } ?>
<?php if ($list[$i]['is_member']) { ?>
<span class="is_secret"><i class="fa-solid fa-user-lock"></i></span>
<?php } ?>나는 제목과 댓글수 사이에 보이도록 추가함
<span class="item-subject">
<?php echo $list[$i]['subject']; ?>
<?php if ($list[$i]['is_secret']) { ?>
<span class="is_secret"><i class="fa-solid fa-lock"></i></span>
<?php } ?>
<?php if ($list[$i]['is_member']) { ?>
<span class="is_secret"><i class="fa-solid fa-user-lock"></i></span>
<?php } ?>
<?php if ($list[$i]['comment_cnt']) {
$comment_num = str_replace(['(', ')'], '', $list[$i]['comment_cnt']);
echo '<span class="comment-count"><i class="fa-solid fa-message"></i>' . $comment_num . '</span>';
} ?>
</span>2-2. style.css
/* 보호글, 멤버공개글 아이콘 */
.is_secret {
display: inline-flex;
align-items: center;
gap: 3px;
margin-left: 3px;
opacity: 0.5;
}
.is_secret i {
font-size: 10px;
}- 이전글최신글에서 오늘 작성한 글은 TODAY로 표시하기 26.05.23
- 다음글유튜브 반응형 적용하기 26.05.19
댓글목록
등록된 댓글이 없습니다.