웹마스터 팁

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

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

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;

잘 사용 하시기를..

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


본 소스는 베타 버젼에 적용 가능합니다.
제목 글쓴이 날짜
외부페이지에서 로그인 폼 구현하기 컴퓨터매니아 2013.09.09
[주옥시리즈] 타이틀 제어 애드온 socialskyo 2013.09.09
[주옥시리즈] [1.7.4] 로그인창 옆에 신규 쪽지 수 보여주기 [3] socialskyo 2013.09.09
추천 취소 기능 만들기 [5] file Summer 2013.09.11
게시글 추천 아이피 가져오기 file Stellar 2013.09.12
Apache .htaccess 작성요령 [10] 컴매냐 2013.09.19
스케치북 게시판에 로그인/로그아웃 버튼 만들기 [1] Arp. 2013.09.22
XE 로만든 앱 + 푸쉬기능 구현하기 (안드로이드) [53] file Xiso 2013.10.16
Content 확장위젯2 에서 권한설정 안되던 버그 xe1.7 garnecia 2013.11.18
[수정]알림센터 Lite에 메일발송 기능을 추가하기 [11] file 매실茶 2013.11.25
소셜 XE 페이스북 로그인 에러 해결 방법 file 신평 2013.11.30
새로운 쪽지 유무에 따라 이미지 변경하는 법 [2] 멀티비타민 2013.12.16
나만의 익명게시판에서 닉네임 확인하는 방법(꼼수라고 밝힙니다.) [5] 착한부산남자 2014.01.03
스케치북 게시판 사용시 "내용을 입력해주세요"라고 뜨면서 댓글 입력이 안될경우 체크해봐야할 사항 [1] socialskyo 2014.01.07
1.5 -> 1.7 업글중 백지상태 부분!! una_nampyeon 2014.02.03
스윙브라우저 유저분들 필독. [10] KSG2013 2014.02.08
글쓰기를 클릭하면 띄워지는 테두리 없는 예쁜 팝업 띄우기 core. 1.7.4 [4] file 마음의빈자리 2014.02.11
nginx 에서 서브도메인 사용시 로그인유지방법 [3] garnecia 2014.02.26
로그인 안하면 코멘트 볼 수 없게 스킨 수정하는 법 [3] W.O 2014.03.23
VB.NET에서 XE로그인 연동하기.[내용추가] [3] AppSeedKorea 2014.03.26