공지사항 최신날짜 순으로 출력 문의 채택완료
공지사항을 여러개 체크하면 글쓴 순서로 출력이 되는데요.
최신 날짜 순으로 나오게 하려면 어떻게하는지요?
bbs/list.php 여기서 어떻게하면 될것 같은데 아무리해도 안되서요.
// 공지 처리
if (!$sca && !$stx) {
$arr_notice = explode(',', trim($board['bo_notice']));
$from_notice_idx = ($page - 1) * $page_rows;
if($from_notice_idx < 0)
$from_notice_idx = 0;
$board_notice_count = count($arr_notice);
for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
$notice_array[] = $row['wr_id'];
if($k < $from_notice_idx) continue;
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
$list[$i]['is_notice'] = true;
$i++;
$notice_count++;
if($notice_count >= $list_page_rows)
break;
}
}
답변 2개
아래 빨간부분을 추가해보세요.
$arr_notice = explode(',', trim($board['bo_notice']));
$arr_notice = array_reverse($arr_notice);
$from_notice_idx = ($page - 1) * $page_rows;
답변에 대한 댓글 2개
공지는 체크한 순서대로 저장이 되네요.
배열의 값의 순서로 변경했습니다.
빨간색 부분을 아래의 소스로 변경해보세요.
rsort($arr_notice);
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
추가하니 정렬이 어떤순인지는 모르지만 되긴하는데 최신글로 정렬은 안되네요.