웹마스터 팁


안녕하세요~

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

지허님이 올려주신 게시물(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
제목 글쓴이 날짜
플래시 컨트럴 활성화하라는 메시지 없애기 [4] file 달구벌 2008.04.08
외부페이지에서 매개변수 사용하기 [2] JnCsoft 2008.04.07
사각박스 코너를 이미지없이 둥글게 만드는법 [5] 느까끼 2008.04.07
최근 이미지 목록 + 라이트박스 [6] file 베니 2008.04.04
플래시로 페이지에 랜덤 이미지 돌리기 [3] ☜ TeRy ☞ 2008.04.04
환율 계산 팝업창 띄우기 [9] file RainSky 2008.04.03
게시판을 외부레이아웃에 넣기 [4] file 박봉수610 2008.04.03
갓난아기 상태의 제로보드 유저를 위한 팁. [2] font 2008.04.01
카테고리부분의 너비조절하기 [3] file gajagu 2008.04.01
탭 형태 문서출력에서 목록수 지정하기. [3] Zerode 2008.03.31
양력/음력DB 홈페이지에 사용하기 [2] 감뿌리 2008.03.29
로그인풀림방지 - 자동 www 붙이는 다른 방법 [23] RainSky 2008.03.28
사이트 주소로 접속했을때 XE폴더로 이동하기 #2 [15] 베니 2008.03.28
''권한이 없습니다'' 라는 문구를 조금 더 부드럽게 바꾸기 [3] file RainSky 2008.03.21
좁은폭의 레이아웃을 쓰시는 분들을 위하여 (게시판 제목부분 깔끔하게 만들기) [5] file gajagu 2008.03.20
상담/신청 (쓰기만 가능한 게시판) 만들기 [10] mmx900 2008.03.20
업데이트 후 댓글 입력 창이 안 나올때...(댓글 에디터) file 수지보더 2008.03.20
로그인 풀림현상 원인 파악 [3] 남국 2008.03.19
플래시 Embed패치(이올라스) 충돌에 의한 파일첨부버튼 해결법 [2] Guns 2008.03.18
큰 파일의 썸네일이 안생길때 해결방법-추가 [7] HIKARU 2008.03.18