웹마스터 팁

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

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

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;

잘 사용 하시기를..

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


본 소스는 베타 버젼에 적용 가능합니다.
제목 글쓴이 날짜
게시판 별로 에디터의 옵션 설정하기 [6] 레드맨 2008.01.01
서브 메뉴를 항상 펼쳐있도록... [2] :맥노턴 2008.01.01
원하는 값으로 게시판 정렬하기 [3] 화니군 2007.12.30
xe에 라이프팟 연동하기 [6] 가클 2007.12.30
레벨에 따라 자동으로 그룹 변경하기 [11] 지연아빠 2007.12.29
Parse error: parse error, unexpected '':'' in /home/hosting_users/xxx/www/xx/classes/template/TemplateHandler.class.php(341) : eval()''+ 'd code on line 14 에러에 대하여... 왕경태 2007.12.29
플래쉬 테두리 없애기 [3] 부우우 2007.12.28
대용량 파일 첨부 업로드시 php.ini 파일조정값들 [5] 비나무 2007.12.28
APM_Setup 6 과 ZBXE 설치하기(개인서버) [3] 백성찬 2007.12.27
제로보드에서 로그인후 테크노트에서 로그인정보 사용하기 [4] JinHoHan 2007.12.26
Ms 워드로 게시판 글쓰기 [1] file 더하기나무 2007.12.25
관리자 포인트 조작 없이 레벨 아이콘 대신 원하는 아이콘 띄우기 [9] file ꂎꌰ&#41 2007.12.24
XE설치시 인스톨화면으로 무한 롭백오류 [2] cen89co 2007.12.23
외부프로그램(페이지)에서 zbxe 로그인 정보 연동하기 [33] file 도데군 2007.12.23
회원가입시 추가한 추가정보를 관리자와 회원자신만 보기... [5] 지연아빠 2007.12.22
회원이 이름, 닉네임등 정보 변경 못하도록 하기 [8] 지연아빠 2007.12.22
IE Toy 사용시 ''페이지'', ''외부페이지'' 차단되네요... [2] 폭풍의 전야 2007.12.22
xml 포함한 플래쉬를 제로보드xe 에서 적용하는 과정 [4] file 도토리나무 2007.12.20
IP대역에 따라 다른 페이지 보여주기 [1] 지연아빠 2007.12.20
최근 댓글이 가장 위로 정렬 [2] 쏘프티 2007.12.20