댓글부분에 DHML 삽입이 가능할까요?
가능하다면
설명 부탁을 드려도 될지요.
답변 1개 / 댓글 2개
채택된 답변
+20 포인트
᠋᠋᠋᠋익명닉네임
2015-07-03 (금) 16:41:40
그누보드 5 기준입니다.
Copy
// 1번째 코드표 아래로 변경하시오..<?phpif (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가include_once(G5_EDITOR_LIB);?>// 여기 까지 변경하시오.. // 댓글 리스트 부분 부분을 아래와 같이 수정하시오.// 변경 전 $comment = $list[$i]['content'];// 변경 후 $comment = $list[$i]['content1'];// 여기까지.. // 댓글쓰기부분// 변경 전<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?><textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용"<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea><?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?><script> $("textarea#wr_content[maxlength]").live("keyup change", function() { var str = $(this).val() var mx = parseInt($(this).attr("maxlength")) if (str.length > mx) { $(this).val(str.substr(0, mx)); return false; } });</script> // 댓글쓰기부분// 변경 후<?php$is_dhtml_editor = false;// 모바일에서는 DHTML 에디터 사용불가if ($config['cf_editor'] && !G5_IS_MOBILE) { $is_dhtml_editor = true;}$editor_html = editor_html('wr_content', $c_wr_content, $is_dhtml_editor);$editor_js = '';$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor); echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?> // 자바스크립트 부분 수정하시길 바랍니다. // 수정 전 else if (!document.getElementById('wr_content').value) { alert("댓글을 입력하여 주십시오."); return false; } // 수정 후 <?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
답변에 대한 댓글 2개
익명닉네임
2015-07-03 (금) 17:00:25
사용하실때 주의 하실점이 있습니다. 댓글에 dhtml 사용하실경우 보안 취약점이 나오기 때문에 그점은 ... 저도 어쩔수가 없습니다. 아직 좀더 연구를 해봐야하기 때문입니다.
답변을 작성하려면 로그인이 필요합니다.