웹마스터 팁

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


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


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

제목 글쓴이 날짜
글쓰기를 클릭하면 띄워지는 테두리 없는 예쁜 팝업 띄우기 core. 1.7.4 [4] file 마음의빈자리 2014.02.11
2014년 2월 12일부터 갑자기 사이트(관리자 페이지)가 깨지는 경우. 새하나모 2014.02.12
이메일인증 Error 한방정리 참고해보세요. [4] 애드바이러스 2014.02.12
css 배경이미지 정리 devdevpia 2014.02.13
GNB 메뉴를 쉽게 만드는 jQuery plugin [2] 김개발 2014.02.14
css 가운데정렬 완벽정리! 돼지코구뇽 2014.02.14
"이 페이지 나가기" 경고창이 뜨는 사이트의 경우 [23] 투씨 2014.02.15
카카오스토리 링크 [14] file 맞장 2014.02.15
우분투 12.04 LTS Nginx 최신버전 설치하기 [1] file 도라미 2014.02.17
1.7.4 용 youtube, vimeo, ted 썸네일 적용 document.item.php 수정방법 [9] file 남자인간 2014.02.17
1.7.4 버전용 한글 lang.xml 파일 [5] file 투씨 2014.02.18
IEXPLORER 버젼 호환성 강제 맞추기 davidis 2014.02.18
누리고 쇼핑몰 모바일버전에서 백지화현상 수정하는 팁 [5] garnecia 2014.02.19
XE 1.7.4 "이메일 주소로 계정 찾기" 오류 해결 방법 꿈돌리 2014.02.20
위젯 게시판 선택시 다중선택하기 ! [2] file GomSang 2014.02.21
게시판 목록에서 새창 띄워서 다른 형태 나오게 하기 [3] foret 2014.02.23
게시판 목록의 new 아이콘 바꾸기 [1] foret 2014.02.23
스케치북5 모바일 댓글 작성시 엔터를 쳤을 때 <br /> 코드 뜨는 문제 해결 [7] oryan 2014.02.23
코어 수정 없이 스킨 수정만으로 게시판 목록에 유튜브,비메오 썸네일 출력 [2] foret 2014.02.23
부트스트랩 레이아웃 제작시 메뉴 코딩팁 웹빌드 2014.02.23