일반 페이지에 cheditor5를 사용하려고 합니다.
본문
안녕하세요
계속 챗GPT가 사람을 가지고 놀아서 이렇게 질문드려요:)
일반 페이지(test.html)
cheditor5에디터를 사용하고 싶습니다.
우리가 게시판 글쓰기 누르면 나오는거..
앗! 현재 제가 글을 작성하는 이곳요..
어떻게 해야할 지 모르겠습니다.
루트(www)에 그누보드5 설치되어있습니다.
도움바랍니다.
답변 3
cheditor5 와 ckeditor5 는 서로 다른 에디터입니다.
ckeditor5 를 얘기하는 것 같습니다.
1) ckedtior5 플러그인을 먼저 설치해야 됩니다.
2) 관리자 페이지에서 기본 환경설정 > 기본 에디터 항목을 ckeditor로 설정 후 저장합니다.
3) /test.php
<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/editor.lib.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>에디터 테스트</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; max-width: 1000px; margin: 0 auto; }
.form-group { margin: 15px 0; }
label { display: block; margin-bottom: 5px; font-weight: bold; }
input[type="text"] { width: 100%; padding: 8px; border: 1px solid #ddd; }
.btn { padding: 10px 20px; background: #007bff; color: white; border: none; cursor: pointer; }
</style>
</head>
<body>
<h1>에디터 테스트</h1>
<form method="post" action="#" onsubmit="return formCheck(this);">
<div class="form-group">
<label for="subject">제목</label>
<input type="text" name="subject" id="subject" required>
</div>
<div class="form-group">
<label for="content">내용</label>
<?php echo editor_html('content', ''); ?>
</div>
<div class="form-group">
<button type="submit" class="btn">작성</button>
</div>
</form>
<script>
function formCheck(f) {
if (!f.subject.value.trim()) {
alert('제목을 입력하세요.');
f.subject.focus();
return false;
}
<?php echo get_editor_js('content'); ?>
if (typeof(errmsg) != 'undefined' && errmsg != '') {
alert(errmsg);
if (typeof(errfld) != 'undefined') errfld.focus();
return false;
}
return true;
}
</script>
</body>
</html>
개인적인 파일로 인해서 에디터를 사용할려면 커스터마이징을 해주셔야합니다.
먼저 상단 서버쪽에 기본 커먼환경파일과 에디터 라이브러리 를 호출해주셔야합니다.
그리고 폼작성하시면됩니다.
예를 들어서
<?php
include_once('./_common.php');
include_once(G5_EDITOR_LIB);
?>
<form name="fwrite" method="post" action="save_content.php">
<?php echo editor_html('my_content', '', 1); ?>
<input type="submit" value="작성 완료">
</form>
힘드시면 원한는 기획을 제출하시고 제작의뢰 https://sir.kr/request 해보시기 바랍니다.
챗 GPT 문제가 아니라 사용자가 어느정도 해당 지식이 있어야 합니다.
QNA 로 다룰 문제는 아니고 의뢰로 가셔야 할것 같습니다.