1. 게시판에 정렬을 wr_01로 오름차순 정렬
( 아래 링크로 여분필드로 정렬 )
https://gnustudy.com/bbs/board.php?bo_table=skin_board&wr_id=74
2. 최근게시물로 뽑을때
get_list_thumbnail 에서 wr_01로 오름차순으로 정렬로 출력하고 싶은데
Copy
latest.skin.php
$thumb_w = 450;
$thumb_h = 300;
$list_count = (is_array($list) && $list) ? count($list) : 0;
for ($i=0; $i<count($list); $i++) {
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_w, $thumb_h, false, true);
-------------------------------------------
index.php
<?php echo latest('theme/product', 'product', 4, 20); ?>
가져올때 어떻게 가져와야할까요??? ㅜ
답변 2개 / 댓글 3개
채택된 답변
+20 포인트
마르스컴퍼니
3년 전
* 게시글 정렬과 최신글 정렬을 별개입니다.
게시글 정렬을 여분필드 순으로 적용해도, 최신글 정렬은 최근등록순(내림차순) 입니다.
* get_list_thumbnail() 은 게시글을 정렬해서 가져오는 함수가 아닌,
해당 게시글 하나의 썸네일 이미지를 가져오는 함수입니다.
최신글 추출은 그 전 /lib/latest.lib.php 의 funcation lastest() 에서 처리됩니다.
최신글 추출시 여분필드순으로 하고 싶다면, /lib/latest.lib.php 에서
order by wr_num
-> order by wr_1
로 변경하면 됩니다. (모든 최신글 추출이 wr_1 순이 되는 문제가 있습니다.)
답변에 대한 댓글 2개
HunyStyle
3년 전
마르스컴퍼니
3년 전
개별적으로 적용하려면 좀 더 번거로운 코드 추가/적용을 해야 됩니다.
ex. 기존 latest() 함수 복사하여 latest2()로 함수명 변경
latest2() 함수 수정
1) function latest2($skin_dir='', $bo_table, $rows=10, $subject_len=40, $orderby='wr_num', $cache_time=1, $options='')
2) $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by {$orderby} limit 0, {$rows} ";
3) latest() 호출 대신 latest2() 로 호출
<?php echo latest2('theme/product', 'product', 4, 20, 'wr_1'); ?>
ex. 기존 latest() 함수 복사하여 latest2()로 함수명 변경
latest2() 함수 수정
1) function latest2($skin_dir='', $bo_table, $rows=10, $subject_len=40, $orderby='wr_num', $cache_time=1, $options='')
2) $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by {$orderby} limit 0, {$rows} ";
3) latest() 호출 대신 latest2() 로 호출
<?php echo latest2('theme/product', 'product', 4, 20, 'wr_1'); ?>
3년 전
커스텀 정렬 같은 경우 데이터가 얼마 안될때는 문제가 없으나
많아지면 문제가 됩니다. 기능동작 여부를 떠나 이부분도 같이 생각하시면 좋습니다.
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.
모든 최신글 정렬이 저렇게 밖에 안되는군요 ㅜㅜ
개별적으로 적용되면 참 좋을련만 ㅎㅎㅎ