http://docs.cksource.com/FCKeditor_2.x
http://docs.cksource.com/FCKeditor_2.x/Developers_Guide/Integration/PHP
페이지의 내용은 다음과 같다.
Integration step by step
Step 1
The first thing to do is to include the "PHP Integration Module" file in the top of your page as in the example below:
<?php include_once("fckeditor/fckeditor.php") ; ?>
Of course the include path refers to the place where you have installed your FCKeditor.
Step 2
Now the FCKeditor is available and ready to use. So, just insert the following code in your page to create an instance of the editor inside a <FORM>:
<?php $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/fckeditor/' ; $oFCKeditor->Value = 'This is some sample text. You are using FCKeditor.' ; $oFCKeditor->Create() ; ?>
Step 3
The editor is now ready to be used. Just open the page in your browser to see it at work.
Complete Sample
<?php include_once("fckeditor/fckeditor.php") ; ?> <html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <form action="sampleposteddata.php" method="post" target="_blank"> <?php $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/fckeditor/' ; $oFCKeditor->Value = 'This is some sample text. You are using FCKeditor.' ; $oFCKeditor->Create() ; ?> <br> <input type="submit" value="Submit"> </form> </body> </html>
"FCKeditor1" is the name used to post the editor data on forms.
Configuration Options
You can pass Configuration Options using the Config array. This way you can overwrite the default setting from fckconfig.js for selected users.
<?php $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/fckeditor/' ; //set the EnterMode to "br" (overwrites the default configuration from fckconfig.js) $oFCKeditor->Config['EnterMode'] = 'br'; $oFCKeditor->Value = '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>' ; $oFCKeditor->Create() ; ?>
Handling the posted data
The editor instance just created will behave like a normal <INPUT> field in a form. It will use the name you've used when creating it (in the above sample, "FCKeditor1"). So, if you have magic quotes enabled, retrieve its value by doing something like this:
$sValue = stripslashes( $_POST['FCKeditor1'] ) ;
Additional information
- You can find some samples on how to use the editor in the "_samples/php" directory of the distributed package.
$oFCKeditor = new FCKeditor('b_content') ;
$oFCKeditor->BasePath = '/fckeditor/' ;
$oFCKeditor->Config['EnterMode'] = 'br'; // 엔터키 쳤을때 br 태그를 사용하도록 한다.
$oFCKeditor->ToolbarSet = 'MyToolbar' ; // 툴바의 내용을 임의로 설정한다.
$oFCKeditor->Config['SkinPath'] = '/fckeditor/editor/skins/office2003/' ; // 스킨을 지정한다.
$oFCKeditor->Value = $_row['b_content'] ;
$oFCKeditor->Create() ;
툴바의 내용을 지정하기위해선
/fckeditor/fckconfig.js 이 파일에
FCKConfig.ToolbarSets["MyToolbar"] = [
['Source','Cut','Copy','Paste','PasteText','PasteWord'],
['Undo','Redo','-','Bold','Italic','Underline','StrikeThrough'],
'/',
['FontName','FontSize','TextColor','BGColor'],
['Table','Image','Rule','SpecialChar']
] ;
와 같은 부분을 추가해서 사용한다.
출처 FCKeditor http://ckeditor.com/
'Story > Javascript' 카테고리의 다른 글
네이버 지도 api 사용하기 (0) | 2010.01.13 |
---|---|
input 상자안에 기본값을 설정하고 focus가 들어왔을때 기본값을 없애주는 방법 (0) | 2009.10.08 |
javascript 로 특정 이미지위를 클릭했을때 이미지상 클릭한 좌표값 구하기 (0) | 2009.03.28 |
미디어 플레이어 플레이 목록 asx (0) | 2009.03.27 |
키값을 임의로 지정하는 배열만들기 (0) | 2009.02.23 |