CI 묻고 답하기

제목 웅파님~ CKeditor 사용시 문제요.???
글쓴이 onlybell 작성시각 2010/11/19 12:38:04
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 28872   RSS
다름이 아니라 웅파님께서 알려주신 CKeditor 로 사용하고 있습니다.
그런데 한페이지에 두개의 ckeditor를 생성하니까.. 조금 이상하게
2개중 나중에 생성된 ckeditor에만 글이 써집니다.
문제가 멀까요?? 알려주세요.

<tr>
            <td class="title" align="right"><b style="color:#FF0000">*</b> <b>제품 설명 : 한국어</b></td>
            <td class="value" align="left" colspan="3">
            <!--
            textarea name과 하단 form_ckeditor의 id변수 동일해야 textarea를 ckeditor로 대체해줍니다.
            기존값이 있다면 <textarea></textarea>사이에 선언
            -->
            <textarea name="contents_kor" id="contents_kor"><?=$contents_kor?></textarea>
            <?
            echo form_ckeditor(array(
                'toolbar' => 'cgs_dollar',
                'id'      => 'contents_kor',
                'width'   => '100%',
                'height'  => '200'
            ));
            ?>
           </td>
          </tr>
          <tr>
            <td class="title" align="right"><b style="color:#FF0000">*</b> <b>제품 설명 : 영어</b></td>
            <td class="value" align="left" colspan="3">
            <textarea name="contents_eng" id="contents_eng"><?=$contents_eng?></textarea>
            <?
            echo form_ckeditor(array(
                'toolbar' => 'cgs_dollar',
                'id'      => 'contents_eng',
                'width'   => '100%',
                'height'  => '200'
            ));
            ?>
           </td>
          </tr>
 다음글 email 라이브러리 셋팅 어떻게 해야되나요? (2)
 이전글 폼체크후 맞는값을 DB에 콜백방식으로 넣기 (2)

댓글

변종원(웅파) / 2010/11/19 15:43:22 / 추천 0
제가 올려드린 헬퍼를 이용한 방식은 하나의 ckeditor만 불러오는 것으로 되어 있습니다.
헬퍼 하단에 보시면
// put the CKEditor 
83.     
'<script type="text/javascript">CKEDITOR.replace("'.$data['id'].'", ' . $options . ');</script>'; 

이런 부분이 있습니다. 이게 실제로 해당하는 id의 textarea를 ckeditor로 대체해주는 것입니다.

id 갯수를 체크하여 위 구문을 갯수에 따라 생성하게 해주시거나 무식한 방법이지만 헬퍼를 하나 더 만들어서
2개의 헬퍼로 사용하시는 방법이 있습니다. ^^;