웹마스터 팁

소스코드를 수정하는 것이므로 반드시 백업을 해두실 것을 권합니다.


※ 첨부파일 경로 등 1,2번에 수정사항이 있습니다. (09.10.21)


목록에서 제목 옆에 있는 댓글수를 클릭해 댓글만 따로 새창으로 보는 팁입니다.

현재는 댓글 보기와 댓글 작성만 가능합니다. 

수정/삭제/답글 기능은 기존 댓글 기능까지 건드려야 해서 나중에 기회가 되면 따로 올리도록 하겠습니다.


전에 게시물 새창으로 보기 팁과 비슷한 방식이라 적용 자체는 그리 어렵지 않습니다만 

css 수정에 다소 애를 먹을 수 있습니다. 그래서 이번에도 샘플을 첨부하니 이대로 해보고 잘 되시면

자신만의 댓글창을 만들어보시길 바랍니다. 



1. 첨부된 샘플파일을 다운 받아 다음과 같은 경로로 압축을 풉니다.

     ※ (수정) 범용성을 위해 경로를 modules/document 에서 modules/board로 수정했습니다. 

      이미 수정하신 분들은 죄송하지만 파일을 아래처럼 옮겨주시기 바랍니다.

popup_comment_layout.html => common/tpl/popup_comment_layout.html


commnet_pop.html => modules/board/tpl/commnet_pop.html

css/comment_pop.css => modules/board/tpl/css/comment_pop.css

images/이미지파일들 => modules/board/tpl/images/이미지파일들


2. modules/document/document.view.php 에서 적당한 곳에 다음 함수를 추가합니다.

     ※ 템플릿 디렉토리를 $this->setTemplatePath($this->module_path.'tpl'); 에서 

      $this->setTemplatePath('./modules/board/tpl'); 로 수정했습니다.


        function dispDocumentCommentPopUp() {

            // 목록 구현에 필요한 변수들을 가져온다

            $document_srl = Context::get('document_srl');


            // document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-;

            $oDocumentModel = &getModel('document');


            // 선택된 문서 표시를 위한 객체 생성 

            $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);

            if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');


            // 브라우저 타이틀 설정

            Context::setBrowserTitle($oDocument->getTitleText());

            Context::set('oDocument', $oDocument);


            // 팝업 레이아웃 선택

            $this->setLayoutPath('./common/tpl');

            $this->setLayoutFile('popup_comment_layout');

            

            $this->setTemplatePath('./modules/board/tpl');

            $this->setTemplateFile('comment_pop');

        } 


3. modules/document/conf/module.xml 에서 19라인쯤에 다음을 추가합니다.


        <action name="dispDocumentCommentPopUp" type="view" standalone="true" />


4. modules/board/tpl/js/board.js 에서 66라인쯤에 /* 댓글 글쓰기 작성후 */ 부분을 찾아 아래처럼 수정합니다.


    var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl).setQuery('act','');

    => var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl);


5. common/js/common.js 에서 popopen 함수를 찾아 그 밑에 아래처럼 popopen2 함수를 추가합니다.


function popopen2(url, target, pop_width, pop_height) {

    if(typeof(target) == "undefined") target = "_blank";

    if(typeof(xeVid)!='undefined' && url.indexOf(request_uri)>-1 && !url.getQuery('vid')) url = url.setQuery('vid',xeVid);

    if(typeof(pop_width) == "undefined") pop_width = "350";

    if(typeof(pop_height) == "undefined") pop_height = "120";

    winopen(url, target, "left=10,top=10,width="+pop_width+",height="+pop_height+",scrollbars=yes,resizable=yes,toolbars=no");

}


6. 이제 스킨의 댓글 링크 부분을 수정합니다. 편의상 xe_official 게시판 스킨을 기준으로 설명드립니다.


modules/board/skins/xe_official/_style.list.html 에서 아래를 찾아


<a href="{getUrl('document_srl', $document->document_srl)}#comment"><span class="replyNum" title="Replies">[{$document->getCommentCount()}]</span></a>


다음과 같이 수정합니다.


<a href="{getUrl('document_srl',$document->document_srl,'act','dispDocumentCommentPopUp')}" onclick="popopen2(this.href,'CommPop',720,400); return false;"><span class="replyNum" title="Replies">[{$document->getCommentCount()}]</span></a>


다른 스킨에서도 댓글 수가 표시되는 부분을 찾아 위처럼 링크를 수정해주시면 됩니다.

제목 글쓴이 날짜
외부 이미지 저장 애드온 [7] file samsara 2013.03.26
XE 1.5.X , 1.7.X 용 nginx rewrite [4] Root 2013.03.24
nginx에서 짧은 주소가 동작하지 않는 경우 해결 [3] Gunmania 2013.03.24
재미있는 조건문 팁 두 가지. [2] 엘카 2013.03.23
팝업모듈에서 jQuery 충돌 해결 - 팝업창이 안뜰때. [5] file 똑디 2013.03.22
요약 책갈피 경량판 sns 링크 버튼 디자인 보완 [1] file 웹플러스7 2013.03.21
팝업모듈 사용시 슬라이드js와 충돌문제 [2] 꿈틀잉 2013.03.21
Sketchbook5 레이아웃과 관리자메뉴 충돌 해결 [2] file YJSoft 2013.03.20
회원가입 확장 모듈 1.7.X 및 모바일에서 사용가능하도록 [10] file hhgyu 2013.03.18
외부이미지 저장 애드온을 본문을 읽으면 작동하도록 하자!! 1.7.3적용 [18] 하얀마법 2013.03.16
1.7 버전의 새로워진 사이트맵(메뉴편집)에 적응해보자! [8] file EnuX 2013.03.15
팝업 모듈에서, 사이트 전체에 팝업 띄우는 방법 모르시는 분들을 위해 ^^; [2] sejin7940 2013.03.13
xe 속도 엄청 빨라집니다. [4] 투투투쓰리 2013.03.12
지식인 모듈 기본스킨에서 카테고리 선택 안 해도 질문이 등록되는 버그 수정법 sejin7940 2013.03.12
데이타베이스 복제를 하면 속도가 8%정도 빨라짐 가을풍경 2013.03.03
회원가입시 유저가 비공개 설정하기 [1] file 모앱 2013.03.03
XE 루트로 접속하기 (이동 필요없음) [12] 모앱 2013.03.03
제로보드 4 -> xe 신버전으로 마이그레이션 경험담 [4] file 윤안젤로 2013.02.28
XE 루트로 옮기기 완벽 가이드 [/xe/ 로부터 벗어나자!] ver 1.1 [107] file LI-NA 2013.02.26
RSS 게시판 업데이터 모듈이 SSL 부분적용시 동작하지 않는 문제 해결하기 [25] Gunmania 2013.02.25