웹마스터 팁


안녕하세요~

새해 새벽인데...이러고 있습니다ㅋ ^^;;

지허님이 올려주신 게시물(http://www.zeroboard.com/15870820 )을 참고했는데 아무리해도 안되길래 좀 헤매다가 조금 전에야 성공을 해서 도움될까 해서 올려 봅니다.
지허님께 우선 감사드리구요~^^

지허님이 올리신 것 하고 약간 틀린데 지허님은 document_srl을 가지고 처리하시는 것이고 저는 mid값으로 처리합니다. 차이점은 게시물로 보느냐 게시판으로 보느냐가 됩니다. mid값은 XE어드민페이지에서 작업 해보신 분이라면 누구나 잘 아실 것이니 제가 지금부터 설명하려는 것은 게시판 성격에 따라 에디터의 옵션을 주는 것입니다.

1.
/modules/board/board.view.php파일을 엽니다. 거기보면 editor의 옵션을 설정하는 부분이 있습니다.

        /**
         * @brief 글 작성 화면 출력
         **/
        function dispBoardWrite() {
            // 권한 체크
            if(!$this->grant->write_document) return $this->dispBoardMessage('msg_not_permitted');
            // GET parameter에서 document_srl을 가져옴
            $document_srl = Context::get('document_srl');
            // document 모듈 객체 생성
            $oDocumentModel = &getModel('document');
            $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager);
            $oDocument->setDocument($document_srl);
            if(!$oDocument->isExists()) {
                $document_srl = getNextSequence();
                Context::set('document_srl',$document_srl);
            }
            // 글을 수정하려고 할 경우 권한이 없는 경우 비밀번호 입력화면으로
            if($oDocument->isExists()&&!$oDocument->isGranted()) return $this->setTemplateFile('input_password_form');
            Context::set('document_srl',$document_srl);
            Context::set('oDocument', $oDocument);
            // 에디터 모듈의 getEditor를 호출하여 세팅
            $oEditorModel = &getModel('editor');
            $option->primary_key_name = 'document_srl';
            $option->content_key_name = 'content';
            $option->allow_fileupload = $this->grant->fileupload;
            $option->enable_autosave = true;
            $option->enable_default_component = true;
            $option->enable_component = true;
            $option->resizable = true;
            $option->height = 400;
            $editor = $oEditorModel->getEditor($document_srl, $option);
            Context::set('editor', $editor);
           //생성한 게시판들 중에서 특정 게시판의 editor component 변경을 위해 추가 : redman추가
           if($this->module_info->mid == '+
 '+
 'product' || $this->module_info->mid == 'notice' || $this->module_info->mid ==  'question_and_consult') $this->setEditor($document_srl, 100);   //이 mid값들은 zexe관리자페이지에서 정의한 mid값으로 바꿔주시면 됩니다.
           //생성한 게시판들 중에서 특정 게시판의 editor component 변경을 위해 추가 : redman추가
            // 확장변수처리를 위해 xml_js_filter를 직접 header에 적용
            $oDocumentController = &getController('document');
            $oDocumentController->addXmlJsFilter($this->module_info);
            $this->setTemplateFile('write_form');
        }

그 바로 밑에 redman추가 라고 되어 있는 소스를 추가 해줍니다. mid값들은 정의하신 값으로 변경 해주시고 게시판 2개만 바꿔주실 거면 if($this->module_info->mid == 'product' || $this->module_info->mid == 'notice' ) 이런식으로 하나만 바꾸실 거면
if($this->module_info->mid == 'product') 이런식으로 수정하시면 됩니다.

2.
위 1번대로 하고 나서, board.view.php 어디 적당한 곳에 다음과 같은 setEditor함수를 정의해 줍니다. 저는 setEditor함수를 dispBoardMessage()함수와 setCommentEditor()함수 사이에 추가 해줬습니다.

        /**
         * @brief 메세지 출력
         **/
        function dispBoardMessage($msg_code) {
            $msg = Context::getLang($msg_code);
            if(!$msg) $msg = $msg_code;
            Context::set('message', $msg);
            $this->setTemplateFile('message');
        }
       /**
     * redman 추가
        * @brief 본문 editor 를 세팅
        * 컴포넌트를 안보이도록 세팅.\n
        **/  
        function setEditor($document_srl, $height) {
            // 에디터 모듈의 getEditor를 호출하여 세팅
             $oEditorModel = &getModel('editor');
             $option->primary_key_name = 'document_srl';
             $option->content_key_name = 'content';
             $option->allow_fileupload = $this->grant->fileupload; //파일업로드 권한을 가졌으면 파일업로드 가능하도록 합니다.
             $option->enable_autosave = true;
             $option->enable_default_component = true;
             $option->enable_component = true;
             if(!$this->grant->is_admin) $option->enable_component = false;  //관리자 권한을 가지지 않은 경우에는 추가 컴포넌트를 사용하지 못하도록 합니다.
             $option->resizable = true;
             $option->height = $height;
             $editor = $oEditorModel->getEditor($document_srl, $option);
             Context::set('editor', $editor);
        }
        /**
         * @brief 댓글의 editor 를 세팅
         * 댓글의 경우 수정하는 경우가 아니라면 고유값이 없음.\n
         * 따라서 고유값이 없을 경우 고유값을 가져와서 지정해 주어야 함
         **/
        function setCommentEditor($comment_srl = 0, $height = 100) {


이렇게 하면 mid이름 별로, 그러니까 원하는 게시판 별로 에디터의 옵션을 조정할 수 있게 됩니다. 또한 저런식이면 댓글 에디터도 수정 가능합니다. 같은 방식이니까 한번 해보셔도 좋으실 것 같습니다.

원래는 enable_default_component나 enable_component의 세부 옵션들에서 일부를 빼고 싶었는데 저렇게 밖에 안되는군요. 더 건드리려면 /modules/editor/skins/default/editor.html 을 수정해야 하는데 for문으로 돌아가더군요. 빼기 힘듭니다.;;;

그러면, 잘 활용해 보시기 바랍니다. ^^ 새해 복 많이 받으시구요~

태그 연관 글
  1. [2018/01/06] 묻고답하기 www.도메인.com/xe 리다이렉트 문의 by 비욘세
  2. [2017/09/25] 묻고답하기 크롬에서 ckeditor 붙여넣기가 이상합니다. ㅠ by 토순이 *4
  3. [2017/08/04] 묻고답하기 메모장으로 php 파일 수정 후 모바일에서 메뉴 깨짐 현상 by Kodumul *1
  4. [2016/12/05] 묻고답하기 혹시 표 작업 깔끔히 잘 되는 에디터툴 있을까요. by 섬휘
  5. [2016/11/24] 묻고답하기 아무리 검색해도 모르겠네요. 에디터 문제 부탁드립니다. by 섬휘 *1
제목 글쓴이 날짜
알림LITE의 모바일쪽지 확인시 "잘못된 요청" 처리법 [1] Hello_XE 2014.10.28
IIS에서의 URL 재작성 사용하기 [5] file ehii 2014.10.30
관리자 회원목록의 회원검색에 생일 항목 추가하는 방법 sejin7940 2014.11.03
ie11에서 한글파일이름 다운로드시 깨짐 방지 방법 맥가이버878 2014.11.04
지도 링크 주소 형식 ms.kim 2014.11.05
회원가입 인증메일 Gmail 설정해도 메일 안 올 때 저는 이렇게 했습니다. [12] file 마키치노 2014.11.06
ipTIME NAS 에 설치한 XE, 다올CMS 첨부파일 버튼 무반응 해결 [1] 사이버짱 2014.11.07
댓글 작성시 '서버에 요청 중입니다.' 메세지만 뜨고 무반응 일 경우 (모두는 아님) file 마키치노 2014.11.11
phpmyadmin 설치뒤 setup 스크립트는 삭제해야 [1] YJSoft 2014.11.12
전화번호 입력시 자동 focus Lansi 2014.11.13
cloudflare에서 nginx 아이피 제대로 표시하기 [3] natura 2014.11.13
위젯수정시 _getContent method is not exists 에러 뜨는 문제 [2] 황비 2014.11.14
SEO 모듈 수정을 통한 Google analytics User ID 추적코드 삽입 하얀마법 2014.11.14
본문에서 작성자 글 모아서 보여주기 [15] 하얀마법 2014.11.15
본문에서 작성자 글 모아서 보여주기 - 응용버전 [4] 하얀마법 2014.11.15
본문을 애드센스 주변에 배치하기 [1] file 하얀마법 2014.11.15
포트포워딩없이 외부접속 허용하기(윈도우 서버) [1] file 임채원임 2014.11.17
html 붙여넣기 가능한 무료 익명 채팅 프로그램(초간단) [1] file 임채원임 2014.11.17
부트스트랩 툴팁 , 팝오버 TIP file 돼지코구뇽 2014.11.17
회원포인트 목록에서 검색 후 포인트 업데이트시 검색 상황이 그대로 유지되도록 sejin7940 2014.11.20