웹마스터 팁

아마도 많은 분들이 궁금해하셨을만한 기능일듯한데..  몇년이 지나도 이상하게 아직 관련된 팁이 안 올라오네요

예전에 만들어뒀던 팁인데... 아직까지 관련글이 안 올라오길레 공개해둡니다 ^^

 

현재 게시판의 댓글들은...  무조건 시간순으로 노출이 됩니다.

그나마 댓글이 한 페이지 내에서 다 나오면, 마우스 스크롤로 쭉 내려서 보면 되지만..

골치아픈건,  댓글수가 설정해둔 한페이지 개수를 넘어갔을때...  굉장히 보기 안 좋게 나오는점이죠 ^^;

 

공개하는 팁은..   댓글 역순 출력기능입니다.  (최근댓글이 가장 위에 나오는거죠)

불가피하게 Core 도 수정해야하고,   query 도 하나 추가해야하지만..

찬찬히 따라해보시면 아마 무사히 적용가능하실겁니다.

 

단지 이 팁 자체는 1.4  에서 만들어진거여서 1.5에서 테스트는 안 해봤는데,  뭐.. 아마 될꺼예요 ^^;;;

(확인해보니  1.5 에서는   // 정해진 수에 따라 목록을 구해옴   문구가 영어로   // get a list of comments  로 되어있네요)

 

XE 사용에 도움 되시길 바라면서..  ^^

 

 

 

============  댓글 역순으로 하는 방법  ============

 

 

1.  modules/comment/comment.model.php 에서


function getCommentList($document_srl, $page = 0, $is_admin = false, $count = 0) {    함수 내부에서

 

if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1;               

// 정해진 수에 따라 목록을 구해옴
$args->document_srl = $document_srl;
$args->list_count = $comment_count;
$args->page = $page;
$args->page_count = 10;

$output = executeQueryArray('comment.getCommentPageList', $args);

 


부분을 찾아서...    아래처럼 수정할것  (빨간색 부분에, 댓글 역순으로 출력할 게시판 mid 값으로 바꿔주세요)

 


// 정해진 수에 따라 목록을 구해옴
$args->document_srl = $document_srl;
$args->list_count = $comment_count;
$args->page = $page;
$args->page_count = 10;

// 페이지 역순 기능 위해서 수정 (sejin7940)
if(Context::get('mid')=="board_chat") {    
 if(!Context::get('cpage')) $args->page=1;   //  120725 수정부분  (가장 최신 댓글이 있는 첫 페이지가 디본이 되도록)
 $output = executeQueryArray('comment.getCommentPageListReverse', $args);
}
else {
 if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1;               
 $output = executeQueryArray('comment.getCommentPageList', $args);
}

 

 

 

2. modules/comment/queries/getCommentPageListReverse.xml  파일을 추가할 것


<query id="getCommentPageListReverse" action="select">
    <tables>
        <table name="comments" alias="comments" />
        <table name="comments_list" alias="comments_list" />
    </tables>
    <columns>
        <column name="comments.*" />
        <column name="comments_list.depth" alias="depth" />
    </columns>
    <conditions>
        <condition operation="equal" column="comments_list.document_srl" var="document_srl" notnull="notnull" pipe="and" />
        <condition operation="equal" column="comments_list.comment_srl" var="comments.comment_srl" filter="number" pipe="and" />
        <condition operation="more" column="comments_list.head" default="0" pipe="and" />
        <condition operation="more" column="comments_list.arrange" default="0" pipe="and" />
    </conditions>
    <navigation>
        <list_count var="list_count" default="list_count" />
        <page_count var="page_count" default="10" />
        <page var="page" default="1" />
  <index var="sort_index" default="head" order="desc" />
  <index var="sort_index" default="comments_list.depth" order="asc" />
    </navigation>
</query>

 

 

 

제목 글쓴이 날짜
v1.5를 위한 제어판 테마 애드온 정식 [4] file 우진홈 2012.02.13
업데이트 후 사이트 통함검색이 안되시는 분 보십시오^^ RGM 2012.02.12
1.5.1 최근 글 위젯에서 특수문자가 나가는 현상 [7] Crom 2012.02.12
댓글을 역순으로 출력하는 팁 (최근댓글이 가장 위에) [8] sejin7940 2012.02.10
make install 로 설치한 파일 제거 방법 [2] StyleRoot 2012.02.08
[XE1.4.5.10]게시판 파일첨부 버튼이 먹통일 때.. 카리브 2012.02.08
php 피카사 연동 프로그래밍 [1] 강아지60 2012.02.06
v1.5를 위한 팝업 모듈과 팝업 오프너 애드온 [55] file 우진홈 2012.02.06
스마트폰에서 xe 구축 [3] file 최태진814 2012.02.06
XE 포인트 파일캐쉬대신 memcache 사용하기 [4] 최기훈. 2012.02.06
부운영자 [26] file 송동우 2012.02.05
묻고 답하기 게시물 옮기는 法 [2] file CMD 2012.02.05
XE 1.5 이상으로 DB 이전시 일부 DB가 빠질 경우 - 내용추가(0203) [7] sejin7940 2012.02.02
확장변수이용시 숫자 일경우 정렬하기 팁 푸하라 2012.02.02
여러도메인으로 접속시 무조건 하나의 도메인으로 이동시키기 squarehacker 2012.02.02
xe 1.4.5.10 에서 board 1.4.2 (1.5용 게시판) 사용하기 file 양파농부 2012.02.01
HTML 편집모드에서 파일 첨부 본문 삽입시 자바스크립트 오류가 뜨는 문제 수정 팁 [1] misol 2012.02.01
xpresseditor 사용시 첨부파일 본문삽입 중복되는 문제 수정. [13] file misol 2012.01.31
xe1.4.5.10 에서 xe1.5의 xe_solid_enterprise 레이아웃 사용하기 양파농부 2012.01.31
1.5.x 이후 문서보기 유저 지정 애드온 안되는 현상 해결방법. [6] 해피신 2012.01.31