확장형 글쓰기폼 작성 문의

확장형 글쓰기폼 작성 문의

QA

확장형 글쓰기폼 작성 문의

답변 3

본문

테크노트 만 쓰다가 새로 그누보드를 공부중인 초보 입니다.

 

테크노트는 확장형 글쓰기 폼이라고 해서 게시판에  직접 쓰지 않고 별도의 글쓰기폼에 입력하면 그 글이 지정된 게시판에 게시되는 형태를 만들 수 있습니다.

 

그누보드에서도 그게 가능한가요.?? 어떻게 하는지 알고 싶습니다.

이 질문에 댓글 쓰기 :

답변 3

가능은 합니다.
따로 글쓰기 폼을 만들고, 글 쓰기 폼에 생성되어 있는 게시판 목록을 출력해 주고 선택하도록 한 후
전송하면 될 듯 합니다.
다만, 직접 제작이 어려우시다면 해당 내용은 의뢰로 해결하시는 게 좋으실 듯 하네요.

* /page/sample_write.php


<?php
include_once('../common.php');
include_once(G5_EDITOR_LIB);
if (!$is_member) {
    alert('회원만 이용 가능합니다.', G5_BBS_URL.'/login.php');
}
$g5['title'] = '커스텀 글쓰기';
include_once(G5_PATH.'/head.php');
// 게시판 목록 가져오기
$sql = " SELECT bo_table, bo_subject FROM {$g5['board_table']} WHERE bo_use_search = 1 ORDER BY bo_order ";
$result = sql_query($sql);
$board_options = '';
while ($row = sql_fetch_array($result)) {
    $board_options .= "<option value='{$row['bo_table']}'>{$row['bo_subject']}</option>";
}
// 글쓰기 권한 체크는 선택된 게시판에 따라 JavaScript에서 처리
// 에디터 설정
$editor_html = editor_html('wr_content', $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);
// 파일 업로드 설정
$file_count = (int)$board['bo_upload_count'];
?>
<section id="bo_w">
    <h2 class="sound_only"><?php echo $g5['title'] ?></h2>
    <form name="fwrite" id="fwrite" action="<?php echo G5_BBS_URL; ?>/write_update.php" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
    <input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
    <input type="hidden" name="w" value="<?php echo $w ?>">
    <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
    <input type="hidden" name="sca" value="<?php echo $sca ?>">
    <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
    <input type="hidden" name="stx" value="<?php echo $stx ?>">
    <input type="hidden" name="spt" value="<?php echo $spt ?>">
    <input type="hidden" name="sst" value="<?php echo $sst ?>">
    <input type="hidden" name="sod" value="<?php echo $sod ?>">
    <input type="hidden" name="page" value="<?php echo $page ?>">
    <div class="bo_w_select write_div">
        <label for="sel_bo_table">게시판 선택<strong class="sound_only">필수</strong></label>
        <select name="sel_bo_table" id="sel_bo_table" required>
            <option value="">게시판을 선택하세요</option>
            <?php echo $board_options ?>
        </select>
    </div>
    <div class="bo_w_info write_div">
        <label for="wr_subject" class="sound_only">제목<strong>필수</strong></label>
        <input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input full_input required" size="50" maxlength="255" placeholder="제목">
    </div>
    <div class="write_div">
        <label for="wr_content" class="sound_only">내용<strong>필수</strong></label>
        <div class="wr_content <?php echo $is_dhtml_editor ? $config['cf_editor'] : ''; ?>">
            <?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
        </div>
    </div>
    <?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
    <div class="bo_w_flie write_div">
        <div class="file_wr write_div">
            <label for="bf_file_<?php echo $i+1 ?>" class="lb_icon"><i class="fa fa-folder-open" aria-hidden="true"></i><span class="sound_only"> 파일 #<?php echo $i+1 ?></span></label>
            <input type="file" name="bf_file[]" id="bf_file_<?php echo $i+1 ?>" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file ">
        </div>
        <?php if ($is_file_content) { ?>
        <input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="full_input frm_input" size="50" placeholder="파일 설명을 입력해주세요.">
        <?php } ?>
    </div>
    <?php } ?>
    <div class="btn_confirm write_div">
        <a href="javascript:history.back();" class="btn_cancel btn">취소</a>
        <button type="submit" id="btn_submit" accesskey="s" class="btn_submit btn">작성완료</button>
    </div>
    </form>
</section>
<script>
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
function fwrite_submit(f)
{
    var sel_bo_table = f.sel_bo_table.value;
    if (sel_bo_table == "") {
        alert("게시판을 선택해주세요.");
        f.sel_bo_table.focus();
        return false;
    }
    f.bo_table.value = sel_bo_table;
    <?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
    var subject = "";
    var content = "";
    $.ajax({
        url: g5_bbs_url+"/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.returnFocus();
        else
            f.wr_content.focus();
        return false;
    }
    if (document.getElementById("char_count")) {
        if (char_min > 0 || char_max > 0) {
            var cnt = parseInt(check_byte("wr_content", "char_count"));
            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;
            }
        }
    }
    document.getElementById("btn_submit").disabled = "disabled";
    return true;
}
</script>
<?php
include_once(G5_PATH.'/tail.php');
?>
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 0
© SIRSOFT
현재 페이지 제일 처음으로