Home > 애드온 > 원댓/대댓 따로따로 > 애드온 적용 방법

애드온 적용 방법

by 아포리아 posted Mar 26, 2022 Views 165 Likes 0 Replies 0

1. 설치

- 애드온을 설치합니다. 경로는 ./addons/ap_comment_list

 

 

2. 설정

- 애드온 설정으로 들어갑니다. 관리자 페이지 > 설치된 애드온 > 원댓글/대댓글 따로 애드온

- PC 또는 모바일 체크박스를 체크합니다.

 

 

3. 게시판 스킨 수정 (순정 스케치북 스킨 기준)

- 댓글 목록이 담겨 있는 html 파일을 열기 (보통은 _comment.html)

 

1) 대댓글 열기 링크 삽입

  • <a cond="$comment->recomment_count > 0" class="ico_secret" href="#" onclick="getRecommentList(this, {$comment->comment_srl}); return false;" style="text-decoration: none;color: white;font-weight: normal; margin-left: 8px; height: auto; padding: 2px 6px; border-radius: 3px; background: #999; font-size: .8em;">대댓글({$comment->recomment_count})</a>
  • 보통은 id="comment_{$comment->comment_srl}"라는 속성이 있는 태그 안쪽이면 어디든 괜찮을 것입니다.

 

2) 댓글 페이지네이션 수정

- a 태그 안의 href 속성 값에 들어가 있는 getUrl 함수를 찾아 괄호 안을 살짝 수정

  • 보통은 href="{getUrl('cpage',1)}#{$oDocument->get('document_srl')}_comment"이런 식으로 되어 있는데,

=> 이것을 href="{getUrl('comment_srl', '', 'cpage',1)}#{$oDocument->get('document_srl')}_comment" 같은 식으로 수정

  • 마찬가지로 href="{getUrl('cpage',$page_no)}#{$oDocument->get('document_srl')}_comment" 이것도

=> href="{getUrl('comment_srl', '', 'cpage',$page_no)}#{$oDocument->get('document_srl')}_comment" 으로

  • href="{getUrl('cpage',$oDocument->comment_page_navigation->last_page)}#{$oDocument->get('document_srl')}_comment" 이것도

=> href="{getUrl('comment_srl', '', 'cpage',$oDocument->comment_page_navigation->last_page)}#{$oDocument->get('document_srl')}_comment" 으로

 

3) 스킨 자체 변수를 다시 불러들임

- 대댓글을 로드할 때는 스킨의 comment.html만 가져옵니다. 따라서 스케치북처럼 __setting.html에 자체 변수를 선언하고 있는 스킨들은 변수 전달에 문제가 있을 수 있습니다.

- 따라서, 스케치북의 경우에는 _comment.html 상단에

  • <include target="__setting.html" cond="$comment_head" />

- 라고 다시 한번 선언해주어야 원활한 페이지 구현이 가능합니다.

- 참고로 위 구문에서 $comment_head라는 변수는 대댓글이 있을 경우 애드온에서 전달하는 대댓글들의 헤드, 즉 원댓글의 댓글 번호를 가리킵니다.

 

4) 스케치북의 경우 대댓글의 첨부 파일 목록 숨기기 및 보이기 이벤트가 구현되지 않는데, 이 문제에 관해서는 다음의 문서를 참조하세요.

https://dev.aporia.blog/board_fKje47/41257