웹마스터 팁

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

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

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;

잘 사용 하시기를..

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


본 소스는 베타 버젼에 적용 가능합니다.
제목 글쓴이 날짜
mysql 강좌 .. 요약본 [4] 이성헌 2003.06.05
[진자 유용한] www 자동으로 붙여주기 [6] Dopesoul 2003.05.24
ie60이상버전의 개인정보기능으로 인한 서비스문제 [2] 날파리 2003.05.21
md5 암호화 알고리즘을 488bit blf 알고리즘으로 바꾸기 [17] 김령현 2003.04.04
Apache1.3.27 + PHP4.3.1 + MySQL4.0.12 + ZendOptimizer2.1.0 [6] FriZeX 2003.03.19
qmail-1.03설치⑧ (squirrel웹메일과 연동) 비츠로 2003.02.28
qmail-1.03설치⑦ (qmailadmin 큐메일 웹관리툴) 비츠로 2003.02.28
htaccess를 활용하자 3탄! 사용자인증 [4] [쿨럭]블루엔젤 2003.01.23
잊을만하면 알려드립니다. issue.net 과 motd 파일 [5] Dopesoul 2002.12.28
[초초초(X999)허접강좌]사용자들이 하는 작업 강제 취소,IP막기 [5] -=:{Inuri}:=- 2002.12.21
초보자도 쉽게 이해할수있도록 주석을 자세히 달아놓은 APM 메뉴얼 (3 of 3) [2] Dopesoul 2002.12.21
[FreeBSD] qmail+mysql+vpopmail+qmailadmin 설치 [1] DeX™ 2002.11.26
Apache + PHP + Mysql확실한 연동 및 리눅스 재설치 정보 [2] file 최종우 2002.11.26
리눅스 서버를 구축해 보자! #1 [11] 꼬토 2002.11.21
보안설정을 하다^^ 유의할점. [3] Dopesoul 2002.10.14
나만의 ftp서버 만들기 제2부 -serv-u 4.0- [12] 레드 2002.10.09
자동 apm 설치 쉘스크립트(리눅스) [5] file 김동현 2002.09.15
PHP에서의 SQL문 보안취약성 [5] 김영빈 2002.09.09
[Apache] 윈도우 NT 계열에 서비스 등록하기 [1] file 스카이 2002.09.08
What is the MRTG? [4] Dopesoul 2002.09.06