[ editor ] 네이버 스마트 에디트 SmartEditor2.0 Basic (2.2.1) 설치 > gnuboard

본문 바로가기
사이트 내 전체검색

gnuboard

팁자료 [ editor ] 네이버 스마트 에디트 SmartEditor2.0 Basic (2.2.1) 설치

페이지 정보

작성자 웹지기 댓글 0건 조회 3,101회 작성일 18-09-27 14:23

본문

http://dev.naver.com/projects/smarteditor/download 링크에서 SmartEditor2.0 Basic (2.2.1)버젼을 다운로드 

root 폴더에 smart_editor를 넣을 디렉토리를 생성한다 에디터를 업로드 하고 설정을 시작해볼까요?


게시판 skin 폴더에 write.skin.php에서 현재 사용중인 모든 에디터를 제거한다. 

혹시나 실수 할 수 도 있으니 기존 파일을 다른이름으로 바꾸고 생성해서 사용하는게 좋겠지요?


일단 상단부분에


[code]

<?

//전 스마트 에디터를 이렇게 했습니다.

$g4[smart_path] = "$g4[path]/smartedit2";

// Naver SmartEditor 삽입 

if($is_dhtml_editor) { 

    echo "<script type=\"text/javascript\" src=\"$g4[smart_path]/js/HuskyEZCreator.js\" charset=\"utf-8\"></script>"; 

?>

[/code]


부분을 추가 textarea 부분을

[code]

<textarea <?php if($is_dhtml_editor){?>id="ir1"<?}?> name="wr_content" class="textarea required" rows="5" cols="1" title="내용" <?php if($is_dhtml_editor){?>style="display:none;"<?}?>><?php echo $content?></textarea>

[/code]

이렇게 수정을 한다 id='ir1' 이부분이 에디터와 연결된다


하단 submit 버튼에는 

[code]

<input type="image" src="<?=$board_skin_path?>/img/ok_btn.gif" title="확인" onclick='submitContents(this)' /> 

[/code]

처럼 onclick을 추가한다. 하단부분에 다음과 같은 자바스크립트를 넣어준다


[code]

<?php if ($is_dhtml_editor) { ?>

<script type="text/javascript">

var oEditors = [];

nhn.husky.EZCreator.createInIFrame({

    oAppRef: oEditors,

    elPlaceHolder: "ir1",

    sSkinURI: "<?=$g4[smart_path]?>/SmartEditor2Skin.html", 

    htParams : {

        bUseToolbar : true,

        fOnBeforeUnload : function(){

            //alert("아싸!"); 

        }

    }  , //boolean

    fOnAppLoad : function(){

    //예제 코드

    //oEditors.getById["ir1"].exec("PASTE_HTML", ["로딩이 완료된 후에 본문에 삽입되는 text입니다."]);

    },

    fCreator: "createSEditor2"

});


function pasteHTML() {

    var sHTML = "<span style='color:#FF0000;'>이미지도 같은 방식으로 삽입합니다.<\/span>";

    oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);

}


function showHTML() {

    var sHTML = oEditors.getById["ir1"].getIR();

    alert(sHTML);

}

 

function submitContents(elClickedObj) {

    oEditors.getById["ir1"].exec("UPDATE_CONTENTS_FIELD", []); // 에디터의 내용이 textarea에 적용됩니다.


    // 에디터의 내용에 대한 값 검증은 이곳에서 document.getElementById("ir1").value를 이용해서 처리하면 됩니다.


    try {

        elClickedObj.form.submit();

    } catch(e) {}

}


function setDefaultFont() {

    var sDefaultFont = '돋움';

    var nFontSize = 24;

    oEditors.getById["ir1"].setDefaultFont(sDefaultFont, nFontSize);

}

</script>

<?}?>

[/code]


여기까지 진행하면 에디터는 정상적으로 사용이 가능하다. 하지만, 사진이 문제


사진을 정상적으로 업로드 하기위해서는 다음의 설정이 필요하다

먼저 

smartedit2/quick_photo_uploader/popup/FileUploader.php 

[code]

<?

$new_path = "../upload/".urlencode($_FILES['Filedata']['name']); //이부분을

$new_path = "../../../data/smartedit2/".urlencode($_FILES['Filedata']['name']); //이렇게

//아래 URL을 변경하시면 됩니다.

$url .= "&sFileURL=http://test.naver.com/popup/upload/".urlencode(urlencode($name)); //이부분을  

$url .= "&sFileURL=http://도메인/data/smartedit2/".urlencode(urlencode($name)); //이렇게

?>

[/code]


html5에서 사용되는 업로더

smartedit2/quick_photo_uploader/popup/FileUploader_html5.php

[code]

<?

$newPath = "../upload/".iconv("utf-8", "cp949", $file->name); //이부분을

$newPath = "../../../data/smartedit2/".iconv("utf-8", "cp949", $file->name); //이렇게


$sFileInfo .= "&sFileURL=http://test.naver.com/smartedirot2/".$file->name; //이부분을

$sFileInfo .= "&sFileURL=http://도메인/data/smartedit2/".$file->name; //로 변경

?>

[/code]

이렇게 해서 사진을 업로드 하셔도 아직은 안돼실 거에요 .. 되면 좋구요....



다음은 smartedit2/quick_photo_uploader/popup/QuickPhotoPopup.js

[code]

function callFileUploader (){    

 oFileUploader = new jindo.FileUploader(jindo.$("uploadInputBox"),{     

  sUrl  : 'http://test.naver.com/Official-trunk/workspace/popup/quick_photo/FileUploader.php', //샘플 URL입니다. 

이렇게 되어있는 부분을


function callFileUploader (){    

 oFileUploader = new jindo.FileUploader(jindo.$("uploadInputBox"),{     

  sUrl  : 'http://도메인/smartedit2/quick_photo_uploader/pupup/FileUploader.php', //샘플 URL입니다. 

로 수정해 주시고


function html5Upload() {       

 var tempFile,       

 sUploadURL;            

 sUploadURL= 'http://test.naver.com/popup/quick_photo/FileUploader_html5.php';  //upload URL


부분은


function html5Upload() {      

 var tempFile,       

 sUploadURL;            

 sUploadURL= 'http://도메인/smartedit2/quick_photo_uploader/pupup/FileUploader_html5.php';  //upload URL


이렇게 수정해주시면 됩니다.


마지막 콜백파일 이파일은 수정을 하지 않아도 되기는 합니다. 혹시나 해서 바꿨어요

다음은 smartedit2/quick_photo_uploader/popup/callback.html 파일  


// document.domain 설정   

try { document.domain = "http://*.naver.com"; } catch(e) {}  


// document.domain 설정   try { document.domain = http://도메인; } catch(e) {}


으로 변경

[/code]

추천0 비추천0

댓글목록

등록된 댓글이 없습니다.

Total 54건 3 페이지
  • 24 팁자료[ mysql ] 튜닝 그누보드 - db접속횟수 줄이기
  • 접속자가 증가하다 보면 튜닝을 하게되는데..튜닝을 하는데 있어 db컨넥을 줄이고자 노력합니다.기본 설정 (g4_config), 게시판 설정 (g4_board), 그룹 설정 (g4_group) 을 파일로 만들어 컨넥을 줄일수도 있습니다.동접자는 10분간 현재접속자 기준 최대 1500명, 일일 방문자 3만명 남짓한 사이트에서 테스트 해본결과 서버가 해외에 있어 국내사정보다 못하지만, db접속오류가 현저히 낮아졌으며, 사이트 속도도 나름 쾌적해 졌습니다.먼저, 첨부파일을 다운받아 /adm/upgrade...
  • 웹지기 09-28 2181 0 0 댓글 0
  • 21 플러그인[ g4 ] jysoft lotto
  • jysoft lotto파일이 온전하게 보존이 되지 않아서 조금 깨진듯 하다.어디가 깨졌는지는 아직 확인 안해봄
  • 웹지기 09-28 1 0 0 댓글 0
+1
  • 16 팁자료[ php ] 그누보드 게시판 자동 글쓰기 소스 예제
  • php 그누보드 게시판 자동 글쓰기 소스 예제사람이 직접 글을 작성하고 "글쓰기" 버튼을 누르지 않고, 프로그램으로 글을 올려야 하는 경우 사용[code]&lt;?// m3post 함수 ver 1.00 by 말러83 (2009-12-21)// $newpost[bo_table], $newpost[wr_subject], $newpost[wr_content], $newpost[mb_id] 값만 지정하고,// m3post($newpost); 라고 실행시키면 글이 해당 게시판에 ...
  • 웹지기 09-28 2954 0 0 댓글 0
  • 열람중 팁자료[ editor ] 네이버 스마트 에디트 SmartEditor2.0 Basic (2.2.1) 설치
  • http://dev.naver.com/projects/smarteditor/download 링크에서 SmartEditor2.0 Basic (2.2.1)버젼을 다운로드root 폴더에 smart_editor를 넣을 디렉토리를 생성한다 에디터를 업로드 하고 설정을 시작해볼까요?게시판 skin 폴더에 write.skin.php에서 현재 사용중인 모든 에디터를 제거한다.혹시나 실수 할 수 도 있으니 기존 파일을 다른이름으로 바꾸고 생성해서 사용하는게 좋겠지요?일단 상단부분에[code]&lt;?//...
  • 웹지기 09-27 3102 0 0 댓글 0
  • 14 플러그인syntaxhighlighter 테마 변경
  • https://funyphp.com/bbs/board.php?bo_table=gnuboard&amp;wr_id=18 이 페이지에서 view.skin.php에서 [code] add_stylesheet('&lt;link rel="stylesheet" href="'.G5_SYN_URL.'/style/shThemeDefault.css"&gt;', 0); [/code] 아래처럼 수정을 해주면 테마가 변경이 된다. [code] add...
  • 웹지기 09-23 3132 0 0 댓글 0
  • 13 팁자료게시글 작성시 메일이 보내지지 않을 때 확인사항
  • 비회원일 때 글쓰는 사람이 메일을 적지 않으면 메일이 발송이 되지 않음. 비회원의 경우 메일이 없으므로 발송이 되지 않음. 회원의 경우도 메일이 없으면 발송이 되지 않음. 이를 대용으로 글쓴이의 메일이 없을 경우 관리자의 메일을 대신 불러온다. /lib/mailer.lib.php mailer(); //수정 [code] $fmail = $fmail?$fmail:$config['cf_admin_email']; 또는 if(!$fmail) $fmail = $config['cf_admin_...
  • 웹지기 09-21 2878 0 0 댓글 0
  • 11 플러그인syntaxhighlighter 3.0.83 적용하기
  • 파일을 다운받고 앞축을 푼다. 필요한 두개의 폴더만 업로드 해도 되고 모두 업로드 해도 상관없다. 쉽게 구분하기 위해 /plugin/syntaxhighligher_3.0.83/아래에 다운 받은 파일 업로드 /extend/syntaxhighlighter.extend.php 만들기 [code] &lt;?php if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 define('_SYNTAXHIGHLIGHTER_USE_', true); ...
  • 웹지기 09-19 3214 0 0 댓글 0
  • 10 팁자료[ g4 ] 글쓰기시 외부 링크 이미지 저장하기
  • ※ [배추베이직스킨사용자] write_update.head.skin.php 파일을다운로드 받으세요.혹시 필요하신 분 계시면 도움이 될까해서 올립니다.글쓰기 할 때 외부링크 이미지를 모두 서버에 저장한 후 불러오는 소스입니다.basic스킨을 기준으로 제작되었으며 EUC-KR버전입니다.예를 들어&lt;img src=http://naver.com/logo.gif&gt;이라고 입력하고 글쓰기 버튼을 클릭하면logo.gif를 서버에 저장한 후 이미지 주소를아래와 같이 바꿔서 불러옵니다....
  • 웹지기 09-19 3062 0 0 댓글 0
게시물 검색

회원로그인

접속자집계

오늘
20,514
어제
14,234
최대
33,828
전체
8,489,584

그누보드5
Copyright © funyphp.com. All rights reserved.