웹마스터 팁

에디터가 너무 무겁게 느껴질 때가 있습니다.
에디터 컴포넌트 없이 텍스트 에러이어만 보이게 한다든지..
가장 간단한 해결책은
스킨 수준에서
write_form.html에서
{$editor}부분을
  <textarea class = "textarea_write_form" rows = "10" name="content" value="{$oDocument->getContentText()}" />{strip_tags($oDocument->getContentText())}</textarea>
이런 방식으로 보이게 할 수가 있겠지요..

그렇지 않으면 모듈 수준에서
board.view.php파일을 수정해야 합니다.
원 소스의 수정을 최소하하기 위해 아래의 방식을 적용해 봤습니다.

1.단계
게시판 스킨의 write_form.html에서
{$editor}부분을
적당한 이름으로 바꿉니다. 저는 이렇게 바꿨습니다.
{$jiheo_editor}  ( 어쨋든 원 소스를 건드리는 건 최소화 하기 위해)

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

function dispBoardWrite()
이 함수 안에 있습니다.
            // 에디터 모듈의 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);

이 부분인데 이건 건드리지 않고 그냥 둡니다.
게시판에 따라서 에디터를 주어진 옵션 대로 쓰는 것도 있을 테니까요.
 
이 아래에
            // 에디터 모듈을 사용자 옵션 설정하기 위하여 setJiheoEditor 함수를 호출하여 세팅
            $this->setJiheoEditor($document_srl, 100);
이것을 추가합니다. 함수 이름도 취향에 맞게 만들면 되겠지요.. 단 중복이 안되게...

그럼 setJiheoEditor() 함수가 필요하겠지요..
적당한 위치에..
board.view.php를 보면..
function setCommentEditor($comment_srl = 0, $height = 100)
이 함수가 있는데요.. 코멘트 입력 에디터 폼을 셋팅하기 위한 함수죠.
이 함수와 동일한 방식으로 setJiheoEditor() 함수를 만들어 줍니다.

        function setJiheoEditor($document_srl = 0, $height = 100) {
            Context::set('document_srl', $document_srl);

            // 에디터 모듈의 getEditor를 호출하여 세팅
            $oEditorModel = &getModel('editor');
            $option->primary_key_name = 'document_srl';
            $option->content_key_name = 'content';
            $option->allow_fileupload = false;
            $option->enable_autosave = false;
            $option->enable_default_component = false;
            $option->enable_component = false;
            $option->resizable = true;
            $option->height = $height;
            $jiheo_editor = $oEditorModel->getEditor($document_srl, $option);
            Context::set('jiheo_editor', $jiheo_editor);
        }

기호에 따라 각각의 옵션값을 설정해 주면 됩니다.
이것으로 끝입니다.

저는 방명록 스킨 만들면서 첫번째 방식 그냥 textarea를 쓰는 방법으로 했었는데요.
보드 모듈을 두 번째 방식으로 테스트 해봤습니다.
일단 제가 해봤을 때는 이상없이 작동하더군요..
코메트 부분도 이런 방식으로 함수를 새로 만들어 쓰면 될 것 같습니다.

모듈은 언제든 업데이트 될 수 있기 때문에 가능하면 모듈 수준의 파일들은 안건드리는게 좋을 텐데요
당장에 사용할 필요가 있으면 부득이 수정할 수 밖에 없을 듯 합니다.

다른 분들도 간절히 원하듯이
저도 마찬가지로 이 에디터 옵션 값을 스킨 수준에서 xml 입력 값으로 설정할 수 있으면 좋겠습니다.