1개의 게시물에 글쓰기 본문 2개 작성하는 방법 알려주세요.. 채택완료
1개의 게시물에 글쓰기 / 본문 작성(cheditor사용) 부분을 1개 더 추가 하고자 합니다.
write.skin.php 에서 wr_content 부분을 참조하여 추가복사 후 wr_content_b 으로 수정 하였습니다.
글쓰기 본문테이블이 2개 생성까지는 되었는데 글을 쓰고나면 완료 후 추가한 wr_content_b 부분
본문에 글내용이 저장이 안되어 있습니다. (수정보기로 들어가서 확인시)
본문 작성후 작성완료 하면 에러표시는 없었습니다.
고수님들 답변 부탁해요.. ㅠㅠ
write.skin.php 내용입니다. 제가 수정한 주요부분은 빨강색 표시했습니다.
==============================================================
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($is_dhtml_editor) {
include_once("$g4[path]/lib/cheditor4.lib.php");
echo "";
echo cheditor1('wr_content', '100%', '250');
echo cheditor1('wr_content_b', '100%', '250');
}
?>
.write_head { height:30px; text-align:center; color:#8492A0; }
.field { border:1px solid #ccc; }
// 글자수 제한
var char_min = parseInt(=$write_min?>); // 최소
var char_max = parseInt(=$write_max?>); // 최대
if ($is_password) { ?> if ($is_email) { ?> if ($is_homepage) { ?> if ($is_html) { if ($is_secret) { echo $option_hidden; if ($is_category) { ?> if ($is_link) { ?> if ($is_file) { ?> var objTbl; objRow = objTbl.insertRow(objTbl.rows.length); objCell.innerHTML = ""; flen++; =$file_script; //수정시에 필요한 스크립트?> function del_file() if ($is_trackback) { ?> if ($is_guest) { ?>
if ($is_name) { ?>
이 름
} ?>
패스워드
>
} ?>
이메일
} ?>
홈페이지
} ?>
if($w == 'u' && $is_admin) { // ------------- 글작성일 조회수 수정모드 ?>
NUM 수정
작성일 수정
조회수 수정
} ?>
$option = "";
$option_hidden = "";
if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = "";
if ($is_notice) {
$option .= "공지 ";
}
if ($is_dhtml_editor) {
$option_hidden .= "";
} else {
$option .= "html ";
}
}
if ($is_admin || $is_secret==1) {
$option .= "비밀글 ";
} else {
$option_hidden .= "";
}
}
if ($is_mail) {
$option .= "답변메일받기 ";
}
}
if ($option) {
?>
옵 션
=$option?>
} ?>
구분
} ?>
제품명
모델명
용량
사양
인터페이스
채널수/방식
원산지
쇼핑몰
if ($is_dhtml_editor) { ?>
=cheditor2('wr_content', $content);?>
} else { ?>



if ($write_min || $write_max) { ?>글자}?>
if ($write_min || $write_max) { ?>}?>
} ?>
if ($is_dhtml_editor) { ?>
=cheditor2('wr_content_b', $content_b);?>
} else { ?>



if ($write_min || $write_max) { ?>글자}?>
if ($write_min || $write_max) { ?>}?>
} ?>
for ($i=1; $i<=$g4[link_count]; $i++) { ?>
링크 #=$i?>
} ?>
} ?>
파일첨부

// print_r2($file); ?>
var flen = 0;
function add_file(delete_code)
{
var upload_count = =(int)$board[bo_upload_count]?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var objRow;
var objCell;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objCell = objRow.insertCell(0);
if (delete_code)
objCell.innerHTML += delete_code;
else
{
if ($is_file_content) { ?>
objCell.innerHTML += "
";
} ?>
;
}
}
{
// file_length 이하로는 필드가 삭제되지 않아야 합니다.
var file_length = =(int)$file_length?>;
var objTbl = document.getElementById("variableFiles");
if (objTbl.rows.length - 1 > file_length)
{
objTbl.deleteRow(objTbl.rows.length - 1);
flen--;
}
}
} ?>
트랙백주소
if ($w=="u") { ?>핑 보냄 } ?>
} ?>
왼쪽의 글자를 입력하세요.
} ?>
// 관리자라면 분류 선택에 '공지' 옵션을 추가함
if ($is_admin)
{
echo "
if (typeof(document.fwrite.ca_name) != 'undefined')
{
document.fwrite.ca_name.options.length += 1;
document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].value = '공지';
document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].text = '공지';
}";
}
?>
with (document.fwrite)
{
if (typeof(wr_name) != "undefined")
wr_name.focus();
else if (typeof(wr_subject) != "undefined")
wr_subject.focus();
else if (typeof(wr_content) != "undefined")
wr_content.focus();
if (typeof(ca_name) != "undefined")
if (w.value == "u")
ca_name.value = "=$write[ca_name]?>";
}
function html_auto_br(obj)
{
if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을
태그로 변환하는 기능입니다.");
if (result)
obj.value = "html2";
else
obj.value = "html1";
}
else
obj.value = "";
}
function fwrite_submit(f)
{
/*
var s = "";
if (s = word_filter_check(f.wr_subject.value)) {
alert("제목에 금지단어('"+s+"')가 포함되어있습니다");
return false;
}
if (s = word_filter_check(f.wr_content.value)) {
alert("내용에 금지단어('"+s+"')가 포함되어있습니다");
return false;
}
*/
if (document.getElementById('char_count')) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
}
else if (char_max > 0 && char_max < cnt) {
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
}
if (document.getElementById('tx_wr_content')) {
if (!ed_wr_content.outputBodyText()) {
alert('내용을 입력하십시오.');
ed_wr_content.returnFalse();
return false;
}
}
if ($is_dhtml_editor) echo cheditor3('wr_content');
if ($is_dhtml_editor) echo cheditor3('wr_content_b');
?>
var subject = "";
var content = "";
$.ajax({
url: "=$board_skin_path?>/ajax.filter.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
f.wr_subject.focus();
return false;
}
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
if (typeof(ed_wr_content) != "undefined")
ed_wr_content.returnFalse();
else
f.wr_content.focus();
return false;
}
if (!check_kcaptcha(f.wr_key)) {
return false;
}
document.getElementById('btn_submit').disabled = true;
document.getElementById('btn_list').disabled = true;
if ($g4[https_url])
echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';";
else
echo "f.action = './write_update.php';";
?>
return true;
}
답변 1개
저장조차 안 되는 거라면....
wr_content_b 라는 필드는 기본 여분 필드가 아닌데 db 필드 추가하고 관련 세팅을 하신 건가요?
임의로 하신 거라면 당연히 안되고요. 기본 여분 필드 중 남는 필드를 사용하세요.
wr_8 ~ wr_10 은 남는 것 같은데 예를 들어 wr_10으로 한다고 했을 때
현재 wr_content_b 로 되어 있는 모든 부분을 wr_10으로 바꿔 주시고
입력 부분인 여기를 이렇게 해주세요.
if ($is_dhtml_editor) { ?>
=cheditor2('wr_10', $write[wr_10]);?>
} else { ?>
아니면 db 필드 추가도 했고 저장은 되는데 수정할 때만 입력된 내용이 안 보이는 문제면
이렇게 해주면 됩니다.
if ($is_dhtml_editor) { ?>
=cheditor2('wr_content_b', $write[wr_content_b]);?>
} else { ?>
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
db 안건드렸었구요 .. 말씀대로 여분필드 남는것으로 대체 했더니 잘 됩니다!!