-
무버블 타입 3.2에 FCKeditor 달기망유람 2006. 4. 17. 15:43
무버블타입 3.15로 시작했는데 저번달쯤 3.2 버전이 나왔다. 사실 프로그래밍을 잘 모르는 나로서는 처음 설치할 때 나름대로 애를 많이 먹었기 때문에 업그레이드를 주저하다 이정환닷컴과 Va pensiero sull' ali dorate님들의 블로그를 보고 업그레이드를 하게 되었다. 두 분의 글처럼 업그레이드는 업그레이드용 파일만으로 간단하게 할 수 있었다.
템플릿이나 한글인코딩 문제 등등은 아무 이상없이 모두 잘 업그레이드가 되었는데, 문제는 기존의 웹에디터로 사용했던 HTMLarea가 사라져 버린 것이다. 이 에디터를 다시 설치하려다 블로그를 뒤져 FCKeditor를 설치하게 되었고 나름대로 잘 설치가 되어 지금 글 작성을 무난히(?) 하고 있다.
설치방법은 다음과 같다.
1. 우선 FCKeditor를 다운로드 받는다.
2. 다운 받은 파일을 압축을 풀던, 서버상에서 압축을 풀던 해서 자신이 설치한 서버 내 MT 아래 FCKeditor 폴더를 만들어 파일들을 올려(풀어)놓는다. 즉 /mt/mt-static/FCKeditor가 되겠다.
3. 권한을 설정해 준다. 텔넷 등을 이용해 mt-static 폴더 위치에서 다음과 같은 명령어를 실행하면 된다.
find FCKeditor/ -type f -exec chmod 644 {} \;
find FCKeditor/ -type d -exec chmod 755 {} \;
find FCKeditor/ -name "*.cgi" -exec chmod 755 {} \;4. MT의 파일의 소스를 수정한다. 이 글은 Patrick Klaassen 님의 블로그를 참조했다.
[MT설치폴더]/tmpl/cms/header.tmpl 파일을 header_edit_entry.tmpl 이란 새이름으로 저장한다.저장한 header_edit_entry.tmpl 파일을 열어서 <head>와</head> 사이에 적당한 곳 (끝부분)쯤에 다음의 소스를 삽입한다.
<script type="text/javascript"
src="<TMPL_VAR NAME=STATIC_URI>FCKeditor/fckeditor.js"></script><script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'text' ) ;
oFCKeditor.BasePath = '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;
oFCKeditor.Width = 580 ;
oFCKeditor.Height = 400 ;
oFCKeditor.CheckBrowser = true ;
oFCKeditor.ReplaceTextarea() ;pFCKeditor = new FCKeditor( 'text_more' ) ;
pFCKeditor.BasePath = '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;
pFCKeditor.Width = 580 ;
pFCKeditor.Height = 400 ;
pFCKeditor.CheckBrowser = true ;
pFCKeditor.ReplaceTextarea() ;qFCKeditor = new FCKeditor( 'excerpt' ) ;
qFCKeditor.BasePath = '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;
qFCKeditor.ToolbarSet = "MTExcerpt" ;
qFCKeditor.Width = 580 ;
qFCKeditor.Height = 200 ;
qFCKeditor.CheckBrowser = true ;
qFCKeditor.ReplaceTextarea() ;
}
</script>5. [MT 설치폴더]/tmpl/cms/edit_entry.tmpl 파일을 열어 가장 첫줄에 있는 <TMPL_INCLUDE NAME="header.tmpl">라는 코드를 <TMPL_INCLUDE NAME="header_edit_entry.tmpl"> 로 바꾼다.
- 이를 통해 인쿨르드 파일을 4번에서 새이름으로 저장해 소스를 수정한 파일로 바꾸는 것이다.
6. 그런 다음 같은 edit_entry.tmpl 에서 엔트리 바디와 익스텐드 엔트리의 텍스트에어리어의 아래의 스크립 코드 2개를 삭제한다. (문자열을 찾을 때 canFomat으로 찾으면 찾기 쉽다) 참고로 Htmlarea때 처럼 body 태그를 수정하지 않아도 된다.
<script type="text/javascript">
<!--
if (canFormat) {
with (document) {
write('<a title="<MT_TRANS phrase="Bold" escape="singlequotes">
[...]
}
}
// -->
</script>7. 다음으로는 /mt/mt-static/FCKeditor/fckconfig.js를 열어서 에디터의 툴바 셋트를 조정한다. 불필요한 툴바를 없앤 기본 툴바지만 사용자에 따라서 자신에 필요해 따라 편집하는 것도 좋을 것이다.
원래의 기본 툴바 코드를 아래의 코드로 바꾼다.
FCKConfig.ToolbarSets["Default"] = [
['Source'],
['Cut','Copy','Paste','PasteText','PasteWord','-'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Table','Rule','Smiley','SpecialChar','UniversalKey'],
['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['About']
] ;위의 툴바 코드 밑에 아래의 코드를 새로 추가한다.
FCKConfig.ToolbarSets["MTExcerpt"] = [
['Source'],
['Bold','Italic','Underline','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
] ;빌트인 이미지와 링크브라우저를 비활성화 시킨다.
FCKConfig.LinkBrowser = false ;
FCKConfig.ImageBrowser = false ;8. 이번에는 /mt/mt-static/FCKeditor/fckeditor.js를 열어 31번째 줄에 FCKeditor의 설치 경로를 아래와 같이 넣어준다.
this.BasePath= '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;9. 설치완료
반응형