웹마스터 팁

질문 & 답변에 질문했었는데 답변이 없으셔서
혼자 끙끙하다가 겨우 해결했습니다

최근 댓글이 가장 위로 정렬되도록 하는 소스입니다
참고하시고 더 좋은 방향으로 발전될 수 있도록 사용하시기를...

modules/comment/comment.model.php Line 173 부터 비교해 가면서 수정하세요~~

//modules/comment/comment.model.php 에서 173 line부터 다음으로 수정
//(여기서 // 역순 정렬을 위해 삽입/수정된 부분만 비교해서 바꾸시면 됩니다)

$root = NULL;
$list = NULL;
$root_temp = NULL;           // 역순 정렬을 위해 삽입 (softmind)

// 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음
$logged_info = Context::get('logged_info');

$root_count = 0;
// loop를 돌면서 코멘트의 계층 구조 만듬 
for($i=$comment_count-1;$i>=0;$i--) {

 $comment_srl = $source_list[$i]->comment_srl;
 $parent_srl = $source_list[$i]->parent_srl;
 $member_srl = $source_list[$i]->member_srl;

 // OL/LI 태그를 위한 치환 처리
 $source_list[$i]->content = preg_replace('!<(ol|ul|blockquote)>!is','<\\1 style="margin-left:40px;">',$source_list[$i]->content);

 // url에 대해서 정규표현식으로 치환
 $source_list[$i]->content = preg_replace('!([^>^"^\'^=])(http|https|ftp|mms):\/\/([^ ^<^"^\']*)!is','$1<a href="$2://$3" onclick="window.open(this.href);return false;">$2://$3</a>',' '.$source_list[$i]->content);

 if(!$comment_srl) continue;

 //if($is_admin || $this->isGranted($comment_srl) || $member_srl == $logged_info->member_srl) $source_list[$i]->is_granted = true;

 // 목록을 만듬
 $list[$comment_srl] = $source_list[$i];

 if($parent_srl) {
  $list[$parent_srl]->child[] = &$list[$comment_srl];
 } else {
  $root_temp->child[] = &$list[$comment_srl];   // 역순 정렬을 위해 수정 (softmind)
  $root_count++;          // 역순 정렬을 위해 삽입 (softmind)
 }
}
for($j=0;$j<=$root_count;$j++){        // 역순 정렬을 위해 삽입 (softmind) 
 $root->child[$j] = $root_temp->child[$root_count-$j-1]; // 역순 정렬을 위해 삽입 (softmind)
}               // 역순 정렬을 위해 삽입 (softmind)
$this->_arrangeComment($comment_list, $root->child, 0);
return $comment_list;

잘 사용 하시기를..

혹시 가능하시면 게시판 스킨에서 설정 가능하도록 누가 만들어 주시면 감사할듯~~


본 소스는 베타 버젼에 적용 가능합니다.
제목 글쓴이 날짜
날씨배너입니다. [4] LooK782 2007.12.03
실시간 날씨를 불러오는 박스 입니다. [13] file 범피디 2007.12.03
움직이는 이모티콘 모음입니다. [4] file 범피디 2007.12.04
"파일첨부"가 클릭이 안되시는 분 보셔요. [11] 최강협 2007.12.04
외부페이지에서 매개변수 사용가능하도록 하는 방법 [12] 라르게덴 2007.12.05
XE 설치 진행 후 다시 첫 화면으로 넘어갈때 [2] longkee 2007.12.06
익명게시판 - 문제가 아직 많습니다. (다시 수정) [11] file 올챙이 2007.12.06
배경이미지 만드는 방법입니다. 팔공산 2007.12.06
그림자 박스 만들기.. [3] file 소마세월 2007.12.07
[수정] 최근 이미지 추출에 new 이미지 등이 나타나게 하기... [5] 비나무 2007.12.09
음악플레이기 3종세트 설치 방법(수정) [25] file 팔공산 2007.12.10
top 메뉴를 만들어보자 - layout에서 topmenu 항목만들기 [6] file SensePlus1 2007.12.11
로그인 안되서 files 폴더 지우셨던 분들!! [3] file 율랑 2007.12.11
권한없는 모듈을 만났을때 로그인 페이지 띄우기.. [10] 똑디 2007.12.11
외부페이지 사용법 [8] 길치객 2007.12.11
외부페이지에서 위젯사용하지 않고 로그인 정보 다루기. [5] [1] 길치객 2007.12.12
페이지가 갑자기 하얀화면으로 나올경우에는 이렇게 해보십시오. [9] file 하나로45 2007.12.13
Layout.html 화일의 SEC(순서도)도를 그려봤습니다. [9] file SensePlus1 2007.12.14
ㅎㅎ, 이곳에도 Html 적용이 되네요. [3] file 눈과비 2007.12.14
최근 댓글이 가장 위로 정렬 [2] 쏘프티 2007.12.20