How to setup FCKeditor using php

Step # 1 :

You need to download the FCKeditor source code from the link FCKeditor Download

Step # 2:

Include the PHP code in the top of your page as in the example below:

[code]<?php include_once("fckeditor/fckeditor.php") ; ?>[/code]

Step # 3:

Now the FCKeditor is ready to use. So, just insert the following code in your body tag:

[code]
<form action="#" method="post">
<?php
$oFCKeditor = new FCKeditor(‘FCKeditor1’) ;
$oFCKeditor—>BasePath = ‘/fcktest/fckeditor/’ ;
$oFCKeditor->Value = $_POST[‘FCKeditor1’];
$oFCKeditor->Create() ;
?>
<input type="submit" value="Submit" />
[/code]

Step # 4:
Use it on the top under step 2: We can see the input values output by this code.
[code]
$sValue = stripslashes( $_POST[‘FCKeditor1’] ) ;
[/code]

Step # 5: The editor is now ready to be used. You need to open the page in your browser to see the output.

Example:

[sourcecode language=”plain”]
<?php
include_once("fckeditor/fckeditor.php") ;
echo $sValue = stripslashes( $_POST[‘FCKeditor1’] ) ;
?>
<html>
<head>
<title>FCKeditor – Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<form action="#" method="post">
<?php
$oFCKeditor = new FCKeditor(‘FCKeditor1’) ;
$oFCKeditor->BasePath = ‘http://deshisoft.net/php/fcktest/fckeditor/’ ;
$oFCKeditor->Value = $_POST[‘FCKeditor1’];
$oFCKeditor->Create() ;
?>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
[/sourcecode]

Live: Demo

Leave a Reply

Your email address will not be published. Required fields are marked *


*