웹마스터 팁

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

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

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;

잘 사용 하시기를..

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


본 소스는 베타 버젼에 적용 가능합니다.
제목 글쓴이 날짜
알바트로스 적용후 검색하는 곳에 댓글과 태그 검색 업션 넣기 [1] 비밀얌 2007.11.13
간편해진 페이지 수정법 file coll 2007.11.16
MSN로그인 상태를 홈피좌측 메뉴에 삽입하는 방법 [9] 팔공산 2007.11.27
익명게시판 - 문제가 아직 많습니다. (다시 수정) [11] file 올챙이 2007.12.06
로그인 안되서 files 폴더 지우셨던 분들!! [3] file 율랑 2007.12.11
외부페이지에서 위젯사용하지 않고 로그인 정보 다루기. [5] [1] 길치객 2007.12.12
최근 댓글이 가장 위로 정렬 [2] 쏘프티 2007.12.20
외부프로그램(페이지)에서 zbxe 로그인 정보 연동하기 [33] file 도데군 2007.12.23
제로보드에서 로그인후 테크노트에서 로그인정보 사용하기 [4] JinHoHan 2007.12.26
레벨에 따라 자동으로 그룹 변경하기 [11] 지연아빠 2007.12.29
xe에 라이프팟 연동하기 [6] 가클 2007.12.30
내 홈페이지에 구글 검색용 애드센스 달기 file RulruRalra 2008.01.01
관리자 페이지 않나오게 하기 [1] Diver 2008.01.04
홈페이지에 예쁜 날씨 배너를 달아보자!!!! [3] file blue7376.myid.net 2008.01.28
좌측 로그인 회원 리스트가 많아지면 스크롤 처리 [6] file 똑디 2008.01.29
본인외 회원정보 제어 [1] edgarkim 2008.02.03
로그인후 보여줄 페이지 설정 [4] 권인해 2008.02.11
글을 읽을때 마다 조회수 증가시키기 (0.2.9수정#3) [1] SKYMARU 2008.02.20
로그인 풀림현상 원인 파악 [3] 남국 2008.03.19
''권한이 없습니다'' 라는 문구를 조금 더 부드럽게 바꾸기 [3] file RainSky 2008.03.21