gblog를 수정하고 있습니다. (스마트에디터 적용방법)???
본문
gblog를 수정하고 있습니다.
그런데 글쓰기에 에디터가 작동을 안하네요...ㅠㅡㅠ;;;
아래는 전체 소스입니다...우격다짐으로 에디터가 나오기는 하는데 글내용 입력값이 null로 나와서
update.php파일로 넘어가질 않네요...
벌써 1달동안 씨름하는데...안되네요...혹시 도움을 구할 수 있을까요???
<?
include_once("./_common.php");
include_once("./_common.sub.php");
// chinsun 추가
include_once("$blog_skin_path/head.skin.php");
$g4['title'] = "블로그 글 작성/수정";
if ($current['mb_id'] != $member['mb_id'])
alert('자신의 글만 등록/수정할 수 있습니다.');
if (!$id) $id = 0;
// 글 수정일 경우
if ($m == 'u')
{
$r = sql_fetch("select * from {$gb4['post_table']} where id='{$id}'");
if (empty($r))
alert('존재하지 않는 글입니다.');
extract($r);
$reload = '';
if ($use_comment)
$use_comment = 'checked'; else $use_comment = '';
if ($use_trackback)
$use_trackback = 'checked'; else $use_trackback = '';
if ($use_eolin)
$use_eolin = 'checked'; else $use_eolin = '';
$content = get_text($r['content'],0);
// 태그 가져오기
$tag = get_post_tag($id, ', ');
}
// 글 새로등록 일 경우
else
{
$post_date = date('Y-m-d H:i:s');
$secret = 1;
$reload = 'checked';
if ($current['rss_open'] ) $use_rss = 1;
if ($current['use_comment'] ) $use_comment = 'checked';
if ($current['use_trackback'] ) $use_trackback = 'checked';
$use_eolin = 'checked';
}
$file = get_blog_file($id);
// 분류 호출
$category = array();
$q = sql_query(" select * from {$gb4['category_table']} where blog_id='{$current['id']}' order by rank ");
while ($r = sql_fetch_array($q)) array_push($category, $r);
include_once("$g4[path]/head.sub.php");
include_once("./admin.head.php");
include_once(G5_EDITOR_LIB);
$is_dhtml_editor = true ;
$config['cf_editor'] = "smarteditor2";
$editor_url = G5_EDITOR_URL.'/'."smarteditor2";
//$editor_html = editor_html('content', $content, $is_dhtml_editor);
?>
<div class="adm_info">
<b>글 쓰기</b> : 글을 작성하여 포스팅 하는 페이지 입니다.
</div>
<form name=fwrite method=get action="adm_write_update.php" enctype="multipart/form-data">
<table width=600 cellpadding=0 cellspacing=0 align=center>
<input type=hidden name=m value="<?=$m?>">
<input type=hidden name=id value="<?=$id?>">
<input type=hidden name=mb_id value="<?=$current[mb_id]?>">
<input type=hidden name=url value="<?=$urlencode?>">
<input type=hidden name=me value="<?=$me?>">
<input type=hidden name=page value="<?=$page?>">
<input type=hidden name=cate value="<?=$cate?>">
<tr><td>
<table border=0 cellpadding=3 cellspacing=0 width=100%>
<tr>
<td width=70 height=30> 분류 선택 </td>
<td>
<select name="category_id">
<option value="">전체</option>
<?for($i=0; $i<count($category); $i++){?>
<option value="<?=$category[$i]['id']?>"<?if($category_id==$category[$i]['id']) echo ' selected'?>><?=$category[$i]['category_name']?></option>
<?}?>
</select>
</td>
</tr>
<tr>
<td width=70 height=30> 제목 </td>
<td>
<input type=text name=title style="width:100%;" maxlength=100 size=60 value="<?=$title?>" required itemname="제목">
</td>
</tr>
<tr>
<td colspan="2" class="html">
<div class="write_div">
<label for="content" class="sound_only">내용<strong>필수</strong></label>
<div class="content <?php echo $is_dhtml_editor ? $config['cf_editor'] : ''; ?>">
<?php
// if( preg_match('/\r|\n/', $content) && $content === strip_tags($content, '<a><strong><b>') ) { //textarea로 작성되고, html 내용이 없다면
// $content = nl2br($content);
// }
// $html = "";
$id = "wr_content";
// $html .= "\n".'<script src="'.$editor_url.'/js/service/HuskyEZCreator.js"></script>';
// $html .= "\n".'<script>var g5_editor_url = "'.$editor_url.'", oEditors = [], ed_nonce = "'.ft_nonce_create('smarteditor').'";</script>';
// $html .= "\n".'<script src="'.$editor_url.'/config.js"></script>';
echo '<script src="'.$editor_url.'/js/service/HuskyEZCreator.js"></script>';
echo '<script>var g5_editor_url = "'.$editor_url.'", oEditors = [], ed_nonce = "'.ft_nonce_create('smarteditor').'";</script>';
echo '<script src="'.$editor_url.'/config.js"></script>';
$smarteditor_class = "smarteditor2";
echo "<textarea id=".$id." name=".$id." class=".$smarteditor_class." maxlength=65536 style='width:100%;height:300px'>";
//echo "<textarea id=".$id." name=".$id." maxlength=65536 style='width:100%;height:300px'>";
//echo $wr_content;
echo "</textarea>";
//echo $html;
//$editor_js = '';
//$editor_js .= get_editor_js('id', $is_dhtml_editor);
//$editor_js .= chk_editor_js('id', $is_dhtml_editor);
echo "<script> var {$id}_editor_data = oEditors.getById['{$id}'].getIR();\noEditors.getById['{$id}'].exec('UPDATE_CONTENTS_FIELD', []);\nif(jQuery.inArray(document.getElementById('{$id}').value.toLowerCase().replace(/^\s*|\s*$/g, ''), [' ','<p> </p>','<p><br></p>','<div><br></div>','<p></p>','<br>','']) != -1){document.getElementById('{$id}').value='';}\n </script>";
echo "<script>if (!{$id}_editor_data || jQuery.inArray({$id}_editor_data.toLowerCase(), [' ','<p> </p>','<p><br></p>','<p></p>','<br>']) != -1) { alert(\"내용을 입력해 주십시오.\"); oEditors.getById['{$id}'].exec('FOCUS'); return false; }\n </script>";
?>
</div>
</td>
</tr>
<tr>
<td height=20 colspan=2>
</td>
</tr>
<?
$qry = sql_query("select * from {$gb4[division_table]} order by dv_rank");
if (mysql_num_rows($qry)>0) {
?>
<tr>
<td width=70 height=30> 글주제 </td>
<td>
<select name="division_id">
<option value=0<?if(!$division_id) echo ' selected'?>> 선택안함 </option>
<? while ($res=sql_fetch_array($qry)) { ?>
<option value=<?=$res['dv_id']?><?if($res['dv_id']==$division_id) echo ' selected'?>> <?=$res['dv_name']?> </option>
<?}?>
</select>
</td>
</tr>
<?}?>
<tr>
<td width=70 height=30> 태그 </td>
<td>
<input type=text name=tag maxlength=100 style="width:100%" value="<?=$tag?>">
, 컴마로 구분해 주세요. (예: 블로그, 그누보드, SIR)
</td>
</tr>
<tr>
<td width=70 height=30> 트랙백 </td>
<td>
<input type=text name=trackback_url maxlength=255 size=50 value="<?=$trackback_url?>">
<? if ($m == 'm') { ?>
<input type=checkbox name=ping value=1> 핑 보냄
<? } ?>
</td>
</tr>
<tr>
<td width=70 height=30> 글작성 일시 </td>
<td>
<input type=text name=post_date maxlength=19 style="width:130px;" value="<?=$post_date?>" required itemname="글작성 일시">
<input type=checkbox name=reload <?=$reload?>> 갱신
</td>
</tr>
<tr>
<td width=70 height=30> 공개설정 </td>
<td>
<input type=radio name=secret value=1<?if($secret==1) echo ' checked'?>> 공개
<input type=radio name=secret value=0<?if($secret==0) echo ' checked'?>> 비공개
(비공개 선택시 RSS 도 공개되지 않습니다.)
<!--<input type=radio name=secret value=2<?if($secret==2) echo ' checked'?>> 예약-->
</td>
</tr>
<tr>
<td width=70 height=30> RSS 설정 </td>
<td>
<input type=radio name=use_rss value=1<?if($use_rss==1) echo ' checked'?>> 공개
<input type=radio name=use_rss value=0<?if($use_rss==0) echo ' checked'?>> 비공개
<!--<input type=radio name=secret value=2<?if($secret==2) echo ' checked'?>> 예약-->
</td>
</tr>
<tr>
<td width=70 height=30> 권한 </td>
<td>
<input type=checkbox name=use_comment id=use_comment value=1 <?=$use_comment?>> <label for=use_comment>이 글에 댓글을 쓸 수 있습니다.</label><br/>
<input type=checkbox name=use_trackback id=use_trackback value=1 <?=$use_trackback?>> <label for=use_trackback>이 글에 트랙백을 보낼수 있습니다.</label>
</td>
</tr>
</table>
<br>
<br>
<p align=center>
<button type="submit" id="btn_submit" accesskey="s" class="btn btn-<?php echo $bo_color ?> btn-lg btn-block">작성완료</button>
</p>
<br>
<br>
</td></tr></table>
</form>
<?
//echo get_editor_js("content");
include_once("./admin.tail.php");
include_once("$g4[path]/tail.sub.php");
?>
!-->
답변을 작성하시기 전에 로그인 해주세요.