在线编辑fckeditor

It is very easy to use FCKeditor in your PHP web pages. All the integration files are available in the official distributed package. Just follow these steps.

 

Step 1

Suppose that the editor is installed in the /FCKeditor/ path of your web site. The first thing to do is to include the "PHP Integration Module" file in the top of your page, just like this:

<?php
include("FCKeditor/fckeditor.php") ;
?>

 

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 (usually inside a <FORM>):

<?php
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Value = 'Default text in editor';
$oFCKeditor->Create() ;
?>

"FCKeditor1" is the name used to post the editor data on forms.

 

Step 3

The editor is now ready to be used. Just open the page in your browser to see it at work.

 

The complete sample

<?php
include("FCKeditor/fckeditor.php") ;
?>
<html>
  <head>
    <title>FCKeditor - Sample</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <form action="savedata.php" method="post">
<?php
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Value = 'Default text in editor';
$oFCKeditor->Create() ;
?>
      <br>
      <input type="submit" value="Submit">
    </form>
  </body>
</html>

 

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, to retrieve its value you can do something like this:

$sValue = stripslashes( 

It is very easy to use FCKeditor in your PHP web pages. All the integration files are available in the official distributed package. Just follow these steps.

 

Step 1

Suppose that the editor is installed in the /FCKeditor/ path of your web site. The first thing to do is to include the "PHP Integration Module" file in the top of your page, just like this:

<?php
include("FCKeditor/fckeditor.php") ;
?>

 

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 (usually inside a <FORM>):

<?php
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Value = 'Default text in editor';
$oFCKeditor->Create() ;
?>

"FCKeditor1" is the name used to post the editor data on forms.

 

Step 3

The editor is now ready to be used. Just open the page in your browser to see it at work.

 

The complete sample

<?php
include("FCKeditor/fckeditor.php") ;
?>
<html>
  <head>
    <title>FCKeditor - Sample</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <form action="savedata.php" method="post">
<?php
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Value = 'Default text in editor';
$oFCKeditor->Create() ;
?>
      <br>
      <input type="submit" value="Submit">
    </form>
  </body>
</html>

 

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, to retrieve its value you can do something like this:

___FCKpd___3

 

Samples

You can find some samples on how to use the editor in the "_samples/php" directory of the distributed package.

 

Other info

If you want to retrieve the resulting HTML instead of outputting it directly to the browser (for example if you're using it in a template engine such as Smarty), you can call the "CreateHtml" method instead:

$output = $oFCKeditor->CreateHtml() ;

 


  • To change the size of the editor in the page, insert the following code before calling the Create() or CreateHtml() methods:

$oFCKeditor->Width  = '100%' ;
$oFCKeditor->Height = '200' ;

and just change the values to your needs.

 


  • To modify configuration settings in a separate file outside the editor's directory, add them to the Config property of the editor object:

$oFCKeditor->Config['CustomConfigurationsPath'] = '/myconfig.js' ;

 


  • To set the path for saving uploaded files uncomment the following line in /FCKeditor/editor/filemanager/browser/default/connectors/php/config.php.

// $Config['UserFilesPath'] = '/UserFiles/' ;
  • Depending on your version, you may also need to set $Config['Enabled'] to true in /FCKeditor/editor/filemanager/browser/default/connectors/php/config.php.

// SECURITY: You must explicitly enable this "connector". (Set it to "true").
$Config['Enabled'] = true ;

Note: Set the permission of the upload directory properly. You should also uncomment the settings of LinkBrowserURL and the ImageBrowserURL in the /FCKeditor_2.0fc/fckconfig.js file for the browsing and uploading function to work properly.

Also set _FileBrowserLanguage and _QuickUploadLanguage to php.

var _FileBrowserLanguage        = 'php' ;
var _QuickUploadLanguage        = 'php' ;

See Built-in File Browser for more information.

Important Note for PHP with Safe Mode activated: You'll have to create /UserFiles/File, /UserFiles/Flash, /UserFiles/Image and /UserFiles/Media in order for the filebrowser to work. Of course, you'll also have to set the correct permissions for these directories. Furthermore, don't use the "Create new folder" button. The folder would be created but couldn't be used (Safe Mode restriction).

POST['FCKeditor1'] ) ;

 

Samples

You can find some samples on how to use the editor in the "_samples/php" directory of the distributed package.

 

Other info

If you want to retrieve the resulting HTML instead of outputting it directly to the browser (for example if you're using it in a template engine such as Smarty), you can call the "CreateHtml" method instead:

___FCKpd___4

 


  • To change the size of the editor in the page, insert the following code before calling the Create() or CreateHtml() methods:

___FCKpd___5

and just change the values to your needs.

 


  • To modify configuration settings in a separate file outside the editor's directory, add them to the Config property of the editor object:

___FCKpd___6

 


  • To set the path for saving uploaded files uncomment the following line in /FCKeditor/editor/filemanager/browser/default/connectors/php/config.php.

___FCKpd___7
  • Depending on your version, you may also need to set $Config['Enabled'] to true in /FCKeditor/editor/filemanager/browser/default/connectors/php/config.php.

___FCKpd___8

Note: Set the permission of the upload directory properly. You should also uncomment the settings of LinkBrowserURL and the ImageBrowserURL in the /FCKeditor_2.0fc/fckconfig.js file for the browsing and uploading function to work properly.

Also set _FileBrowserLanguage and _QuickUploadLanguage to php.

___FCKpd___9

See Built-in File Browser for more information.

Important Note for PHP with Safe Mode activated: You'll have to create /UserFiles/File, /UserFiles/Flash, /UserFiles/Image and /UserFiles/Media in order for the filebrowser to work. Of course, you'll also have to set the correct permissions for these directories. Furthermore, don't use the "Create new folder" button. The folder would be created but couldn't be used (Safe Mode restriction).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值