This is a file/function I wrote to use php generic function to create the fckeditor: **************Filename: pmj_showeditor.php include("PATHTOYOUREDITOR/fckeditor/fckeditor.php") ;
function show_editor($areafieldname="default", $areawidth="100%", $areaheight="200", $content_text="") { if ($areafieldname == "default") { echo "\n<h3>You must include a fieldname in your call to show_editor.<br> Call to show_editor passed with parameters show_editor($areafieldname=\"yourfield\" ,$areawidth=\"size\",$areaheight=\"size\").</h3>\n\n\n"; exit; } echo "\n<font size=\"-1\">To paste MS Word text, click within window, then click Paste From Word button.</font>\n"; $oFCKeditor = new FCKeditor($areafieldname) ; $oFCKeditor->Width = $areawidth; $oFCKeditor->Height = $areaheight; $oFCKeditor->BasePath = /fckeditor/' ; $oFCKeditor->Value = $content_text; $oFCKeditor->Create() ; } ?> ***************end of Code for forms with no field value: include "fckeditor/pmj_showeditor.php"; show_editor("cont_body", "100%", "300");
Code for edit forms that take a field value, i.e, from db: First, do your mysql_fetch_array commands and set your $cont_body = $row['yourdata']; include "fckeditor/pmj_showeditor.php"; show_editor("cont_body", "100%", "300",$cont_body );
RE: Populating FCKeditor from a database
**************Filename: pmj_showeditor.php
include("PATHTOYOUREDITOR/fckeditor/fckeditor.php") ;
function show_editor($areafieldname="default", $areawidth="100%", $areaheight="200", $content_text="") {
if ($areafieldname == "default") {
echo "\n<h3>You must include a fieldname in your call to show_editor.<br>
Call to show_editor passed with parameters show_editor($areafieldname=\"yourfield\"
,$areawidth=\"size\",$areaheight=\"size\").</h3>\n\n\n";
exit;
}
echo "\n<font size=\"-1\">To paste MS Word text, click within window, then click Paste From Word button.</font>\n";
$oFCKeditor = new FCKeditor($areafieldname) ;
$oFCKeditor->Width = $areawidth;
$oFCKeditor->Height = $areaheight;
$oFCKeditor->BasePath = /fckeditor/' ;
$oFCKeditor->Value = $content_text;
$oFCKeditor->Create() ;
}
?>
***************end of
Code for forms with no field value:
include "fckeditor/pmj_showeditor.php";
show_editor("cont_body", "100%", "300");
Code for edit forms that take a field value, i.e, from db:
First, do your mysql_fetch_array commands and set your $cont_body = $row['yourdata'];
include "fckeditor/pmj_showeditor.php";
show_editor("cont_body", "100%", "300",$cont_body );
Hope this helps, pj
RE: Populating FCKeditor from a database
-Sahawk