Hi,
I'm a happy user of FCKEditor with PHPNuke, however, instead of posting the editor value thru some $_POST variable, I need to pass the value of the editor thru a PHP variable.
Here is the actual code used in the document's form :
$oFCKeditor = new FCKeditor('HomeText') ;
$oFCKeditor->Config['AutoDetectLanguage'] = false;
$oFCKeditor->Config['DefaultLanguage'] = "fr";
$oFCKeditor->Config['CustomConfigurationsPath'] = '/modules/FCKeditor/editor/editor.conf.js';
$oFCKeditor->ToolbarSet = "Default";
$oFCKeditor->Create() ;
and I'd like to have something like this :
$oFCKeditor = new FCKeditor('HomeText',$hometext) ;
where the variable $hometext would store the content of the editor when the user click on "submit".
Is it possible with the 2.0 FC release ?
I've been querying a lot this forum about an appropriate solution but w/o any success yet.
I'm a happy user of FCKEditor with PHPNuke, however, instead of posting the editor value thru some $_POST variable, I need to pass the value of the editor thru a PHP variable.
Here is the actual code used in the document's form :
$oFCKeditor = new FCKeditor('HomeText') ;
$oFCKeditor->Config['AutoDetectLanguage'] = false;
$oFCKeditor->Config['DefaultLanguage'] = "fr";
$oFCKeditor->Config['CustomConfigurationsPath'] = '/modules/FCKeditor/editor/editor.conf.js';
$oFCKeditor->ToolbarSet = "Default";
$oFCKeditor->Create() ;
and I'd like to have something like this :
$oFCKeditor = new FCKeditor('HomeText',$hometext) ;
where the variable $hometext would store the content of the editor when the user click on "submit".
Is it possible with the 2.0 FC release ?
I've been querying a lot this forum about an appropriate solution but w/o any success yet.
RE: Passing value from PHP variable
Do you just not want to POST for some reason?
HomeText is a php variable after you post but I think your going to have to post.
So for example:
$oFCKeditor = new FCKeditor('HomeText') ;
after submit form.
echo stripslashes($HomeText);
will print out what ever was entered in the form. If you want to maintain that information in the php variable through out many pages then you will need to start a session or store it in mysql.
RE: Passing value from PHP variable
The thing is that there is no doc explaining this and the samples do not show this behaviour neither, but still FCKeditor is the definitely the greatest web editor ever.
My last question is :
if the value is passed into a PHP variable after submiting the form, why is it also passed thru a $_POST variable ?
You got twice the same info !
Is there a way to avoid this $_POST variable (PHPNuke forbids $_POST variables containing HTML tags...) ?
RE: Passing value from PHP variable
I don't know anything about PHPNuke but the PHP strip_tags function will get rid of the html or php tags but then will that be any good for you?
RE: Passing value from PHP variable
The problem is that the file "mainfile.php" in PHP check if any $_POST variable contains HTML code with script or style keywords :
foreach ($_POST as $key => $secvalue) {
if ((eregi("<[^>]*script*\"?[^>]*>", $secvalue)) || (eregi("<[^>]*style*\"?[^>]*>", $secvalue))) {
Header("Location: index.php");
die();
}
}
so I've done this :
foreach ($_POST as $key => $secvalue) {
// following 3 lines added for FCKeditor workaround
if ($key == "hometext") {
$secvalue = '';
}
if ((eregi("<[^>]*script*\"?[^>]*>", $secvalue)) || (eregi("<[^>]*style*\"?[^>]*>", $secvalue))) {
Header("Location: index.php");
die();
}
}
and it works.
Thanks,
effco