글쓰기에서 '내용' 필드 입력검사를 아예 하지 않도록 하는 방법은 없는지요?
본문
갤러리 게시판을 만들었는데, 내용은 필요없고 파일만 첨부하면 됩니다.
내용 필드에 글자를 자동으로 넣는 방법 말고 , 아예 빈칸으로 둬도 입력검사에서 통과되도록(즉, 검사에서 아예 제외되도록 ) 하는 방법은 없는지요?
내용 필드에 글자를 자동으로 넣는 방법 말고 , 아예 빈칸으로 둬도 입력검사에서 통과되도록(즉, 검사에서 아예 제외되도록 ) 하는 방법은 없는지요?
답변 2
해결 방법을 찾았습니다!
./bbs/write_update.php 파일 제21~23 라인에 있는
if ($wr_content == '') {
$msg[] = '<strong>내용</strong>을 입력하세요.';
}
를
다음과 같이 수정하면 해당 게시판에서는 내용 필드가 비어 있더라도 검사를 통과합니다.
if ($wr_content == '') {
if ($bo_table!='TABLE이름') { //해당 게시판에서는 내용 필드에 아무것도 입력하지 않아도 통과.
$msg[] = '<strong>내용</strong>을 입력하세요.';
}
}
*** 에디터(ckeditor4)를 쓰는 경우에는 다음과 같이 합니다.
./plugin/editor/ckeditor4/editor.lib.php 파일 제59~66라인에 있는 함수
function chk_editor_js($id, $is_dhtml_editor=true)
{
if ($is_dhtml_editor) {
return "if (!{$id}_editor_data) { alert(\"내용을 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\nif (typeof(f.wr_content)!=\"undefined\") f.wr_content.value = {$id}_editor_data;\n";
} else {
return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
}
}
의 첫줄
if ($is_dhtml_editor) {
앞에 다음 코드를 삽입합니다.
global $bo_table;
if ($bo_table=="TABLE이름") return true;
./bbs/write_update.php 파일 제21~23 라인에 있는
if ($wr_content == '') {
$msg[] = '<strong>내용</strong>을 입력하세요.';
}
를
다음과 같이 수정하면 해당 게시판에서는 내용 필드가 비어 있더라도 검사를 통과합니다.
if ($wr_content == '') {
if ($bo_table!='TABLE이름') { //해당 게시판에서는 내용 필드에 아무것도 입력하지 않아도 통과.
$msg[] = '<strong>내용</strong>을 입력하세요.';
}
}
*** 에디터(ckeditor4)를 쓰는 경우에는 다음과 같이 합니다.
./plugin/editor/ckeditor4/editor.lib.php 파일 제59~66라인에 있는 함수
function chk_editor_js($id, $is_dhtml_editor=true)
{
if ($is_dhtml_editor) {
return "if (!{$id}_editor_data) { alert(\"내용을 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\nif (typeof(f.wr_content)!=\"undefined\") f.wr_content.value = {$id}_editor_data;\n";
} else {
return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
}
}
의 첫줄
if ($is_dhtml_editor) {
앞에 다음 코드를 삽입합니다.
global $bo_table;
if ($bo_table=="TABLE이름") return true;
해당 갤러리 글쓰기 스킨 파일에서
wr_content 값을 textarea에f서 <input type=hidden name="wr_content" id="wr_content" value="자동으로 등되는 글입니다. <?=date("Ymdhis")?>">로 변경하시면 될듯 싶습니다.
value값에 date를 넣는 이유는 동일한 제목으로 여러번 글이 작성되는 것을 방지하기 위함입니다.
실제 반영 테스트 못해봐서 우선 간단히 적어봅니다.
wr_content 값을 textarea에f서 <input type=hidden name="wr_content" id="wr_content" value="자동으로 등되는 글입니다. <?=date("Ymdhis")?>">로 변경하시면 될듯 싶습니다.
value값에 date를 넣는 이유는 동일한 제목으로 여러번 글이 작성되는 것을 방지하기 위함입니다.
실제 반영 테스트 못해봐서 우선 간단히 적어봅니다.
답변을 작성하시기 전에 로그인 해주세요.