그누보드에 레인에디터 설치하기 - 웹 편집기 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

그누보드에 레인에디터 설치하기 - 웹 편집기 정보

그누보드에 레인에디터 설치하기 - 웹 편집기

본문

출처  : http://cafen.net/home/87

1. 레인에디터 설치 - 에디터 설치 메뉴얼 참조 (이하 /editor/ 에 설치되었다고 간주함)

2. 그누 보드용 Lib 설치 gnuboard4/lib/rain_editor.php (아래 내용을 해당 파일에 넣어 둠)

<?

// 에디터 설치 경로에 맞춤

$rain_editor_root = '../../';
include_once($rain_editor_root."editor/library/rainUtil.php");
include_once($rain_editor_root."editor/library/rainRequest.php");
include_once($rain_editor_root."editor/library/rainProperties.php");
include_once($rain_editor_root."editor/library/rainFile.php");
include_once($rain_editor_root."editor/library/rainFileManager.php");
$editor_key = '4d4e81d3f9219886bcadb3dc9b503f82';

$req = new rainRequest($_REQUEST, $_SERVER);
$rfile = new rainFile(rainUtil::getConf("path_uploads"));

function rainParse($memo, $old_contents = '') {
 global $req, $rfile, $editor_key;
 $contents= ($memo != '') ? $req->get($memo) : '';
 if (eregi($editor_key, $contents) || eregi($editor_key, $old_contents)) {
  $contents = $rfile->rainEditAttachSaveDelete($contents, $old_contents);
  $contents_view = rainUtil::addslashes($rfile->rainContents_html);
  $contents_text = $rfile->stripTags($rfile->rainContents_html);
  $contents_attach = $rfile->rainAttachParse(false);
  $contents_image = $rfile->rainAttach_image;
  $is_movie = $rfile->rainAttach_movie;
  $attach_size = $rfile->totalattach_size;
 }
 return $contents;
}

function rainParseContents($memo) {
 global $req, $rfile, $editor_key;
 if (eregi($editor_key, $memo)) {
  $contents = $rfile->rainEditContents($memo);
  $contents_view = $rfile->rainContents_html;
  $contents_text = $rfile->stripTags($rfile->rainContents_html);
  $contents_attach = stripslashes($rfile->rainAttachParse(false));
  $contents_image = $rfile->rainAttach_image;
  $is_movie = $rfile->rainAttach_movie;
  $attach_size = $rfile->totalattach_size;
  return <<<EOT
 $contents_attach<br>
 <div class=blogtext>$contents_view</div>
EOT;
 } else
  return $memo;
}

 

?>

3. 스타일 쉬트 편집

 - gnuboard4/style.css

/* 마지막에 다음 라인 추가 */
.blogtext FONT{line-height:170%;}
.blogtext P,
.blogtext H1,
.blogtext H2,
.blogtext H3,
.blogtext H4,
.blogtext H5,
.blogtext H6 {
 font-family:"굴림,Verdana";
 margin-top:2px;
 margin-bottom:2px;
}
.blogtext A,
.blogtext A:link,
.blogtext A:visited,
.blogtext A:hover {color:#404040; text-decoration:underline}

.blogtext H1 {font-family:arial,Dotum;font-weight:bold;color:#666633;font-size:12pt}
.blogtext H2 {font-family:굴림,Verdana;font-weight:bold;color:#454545;font-size:12pt}
.blogtext H3 {font-family:arial,Dotum;font-weight:bold;color:#999966;font-size:11pt}
.blogtext H4 {font-family:굴림,Verdana;font-weight:bold;color:#454545;font-size:9pt}
.blogtext H5 {}
.blogtext H6 {}

4. 프로그램 패치

 - gnuboard4/skin/board/basic/write.skin.php (해당 스킨 경로)
14 var char_min = parseInt(<?=$write_min?>); // 최소
15 var char_max = parseInt(<?=$write_max?>); // 최대
16 </script>
17+ <script>
18+ var _editor_url = "/editor/";
19+ </script>
20+ <script language="Javascript1.2" src="/editor/prototype-1.4.0.js"></script>
21+ <script language="Javascript1.2" src="/editor/swfupload.js"></script>
22+ <script language="Javascript1.2" src="/editor/rain_util.js"></script>
23+ <script language="Javascript1.2" src="/editor/RainEditor_v10.js"></script>
........................................
124+ <textarea id="wr_content" name="wr_content" class=tx style='width:100%; word-break:break-all;' rows=10 itemname="내용" required(제거)
125 <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>><?=$content?></textarea>
271 function fwrite_check(f) {
272+ RainEditor('wr_content','E');
...........................
328 <script language="JavaScript">
329 window.onload=function() {
330    drawFont();
331 }
332+ RainEditor('wr_content',{});
333 </script>
 
 - gnuboard4/bbs/write_update.php
5 include_once("./_common.php");
6+ include_once("$g4[path]/lib/rain_editor.php");
..................................
190 if ($w == "" || $w == "r")
191 {
192+ $wr_content = rainParse('wr_content');
....................................
293 else if ($w == "u")
294 {
295+ $wr_content = rainParse('wr_content', $wr[wr_content]);

 

 - gnuboard4/bbs/view.php
4 @include_once("$board_skin_path/view.head.skin.php");
5+ include_once("$g4[path]/lib/rain_editor.php");

 - gnuboard4/skin/board/basic/view.skin.php (해당 스킨 경로)
98        <!-- 내용 출력 -->
99+        <span id="writeContents"><?=rainParseContents($view[wr_content]);?></span>

 

 - gnuboard4/bbs/delete.php
6 @include_once("$board_skin_path/delete.head.skin.php");
7+ include_once("$g4[path]/lib/rain_editor.php");
.........................................
94 // 게시글 삭제
95+ $wr = sql_fetch(" select * from $write_table where wr_parent = '$write[wr_id]' ");
96+ rainParse('',$wr[wr_content]);
97 sql_query(" delete from $write_table where wr_parent = '$write[wr_id]' ");

 

앞에 붙어 있는 숫자는 그누보드 4.0 버전에서의 라인 번호 입니다. 누적 번호이기 때문에 필히 앞뒤의 스크립터를 확인하면서 설치를 하셔야 합니다. 버전과 스킨에 따라서 라인번호가 변경될수 있습니다. 번호 뒤에 + 가 붙어 있는 라인만 변경해 줄것

추천
1
  • 복사

댓글 5개

© SIRSOFT
현재 페이지 제일 처음으로