웹마스터 팁

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


※ 첨부파일 경로 등 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>


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

제목 글쓴이 날짜
모든 원하는 확장변수를 선택해서 최근게시물 위젯에 나타내기 간단팁 [12] jsuimage 2009.10.17
1.2.6 버전에서 메뉴추가 안되시는 분들 읽어보세요... [6] Crazyhouse.cn 2009.10.19
댓글 새창으로 보기 (경로수정) [1] file 고진감래 2009.10.20
댓글 삭제/수정/답글 시 팝업창으로 띄우기 [22] file 고진감래 2009.10.21
오늘 게시된 글은 날짜 대신 today 그림으로 대치 (왕초보용 초간단팁) file jsuimage 2009.10.21
Blog API ''not logged'' 오류 해결법 [2] file June Oh 2009.10.23
하나의 게시물을 각각 다르게 보이도록 만드는 방법 [5] 얼터1.0 2009.10.24
제로보드 XE가 갑자기 느려져서 확인해봤더니 [1] jy1664 2009.10.27
게시판 글작성 선택적 메일보내기 - 확장변수 이용 [2] file noirzo 2009.10.28
board.api.php 사용법 [1] file Hide_D 2009.10.29
1.2.6 업데이트 후 애드온 등 css가 적용 안되는 분들~ SeokiE 2009.10.29
카운터위젯 - 오늘 가입한 회원수 전체 회원수 출력 [5] 공수래 2009.11.01
프로필이미지, 이미지마크, 이미지이름 수정, 추가시 포인트 삭감 [1] lattente 2009.11.02
XE로 API 처리 완전 정복하기(1) [6] file 라르게덴 2009.11.02
XE로 API 처리 완전 정복하기(2) [2] file 라르게덴 2009.11.03
게시판 리스트에서 확장변수를 카테고리처럼 보여주기 [11] file 고진감래 2009.11.05
추천인/비추천인 표시하기 [7] file 고진감래 2009.11.05
1.3.0 버전에서 모듈설치 방법과 시작 모듈 설정하기 [21] file 스타호스트 2009.11.11
XE를 처음 접하거나 이제막 사이트개발을 하려는 초보자를 위한 XE 접근방법 [1] DuRi 2009.11.12
"제로보드 XE 기본 개념을 이해하자" 문서화 [3] file amd짱좋아 2009.11.13