Hi all! Does anyone know of a simple tutorial on how to include FCKEditor in a PHP page? It seems simple enough to use but the download is fairly clunky with a bunch of useless files and I'm not sure exactly which ones I need to keep and what to get rid of. Thanks!
Tue, 04/19/2005 - 00:48
#1
RE: Tutorial on setting up FCKEditor and PHP
RE: Tutorial on setting up FCKEditor and PHP
$editor->Value = "whatever content";
but remember to do it BEFORE outputting its content!
RE: Tutorial on setting up FCKEditor and PHP
Then create editor class object for outputting the code of the editor:
$editor=new FCKeditor("name of field");
// Assign the editor its base path
$editor->BasePath="whatever"."/js/";
// Output the editor code:
echo $editor->CreateHTML();
You must take into account that "name of field" must be replaced with your appropiate field name (in the form). The same goes with whatever/js, it must be a path in such way the page that generates the fckeditor code can access the /js folder which contains the fckeditor sourcecode.
Enjoy it!
RE: Tutorial on setting up FCKEditor and PHP
$editor->BasePath="js/";
I get the error:
The requested URL /FCKeditor/js/editor/fckeditor.html was not found on this server.
Setting it like this (or not at all) it loads the editor correctly:
$editor->BasePath="";
This leads me to believe that the 'js' is no where in the path.
RE: Tutorial on setting up FCKEditor and PHP
Like you said, js isn't on the path. I think whoever posted the above sample had some of those mushrooms. =-)
Directly from sample02.php,with the explination of base path even (path to the fckeditor directory(which is set to a default if left blank(BasePath = '/FCKeditor/'))):
<?php // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // $oFCKeditor->BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value. $sBasePath = $_SERVER['PHP_SELF'] ; $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = $sBasePath ; if ( isset($_GET['Lang']) ) { $oFCKeditor->Config['AutoDetectLanguage'] = false ; $oFCKeditor->Config['DefaultLanguage'] = $_GET['Lang'] ; } else { $oFCKeditor->Config['AutoDetectLanguage'] = true ; $oFCKeditor->Config['DefaultLanguage'] = 'en' ; } $oFCKeditor->Value = 'This is some <strong>sample text</strong>. You are using <a href="<a href="http://www.fckeditor.net/" target="_blank">http://www.fckeditor.net/</a>">FCKeditor</a>.' ; $oFCKeditor->Create() ; ?>
RE: Tutorial on setting up FCKEditor and PHP
$sBasePath = $_SERVER['PHP_SELF'] ;
Instead, mine has this line:
$sBasePath = $_SERVER['PATH_INFO'] ;
Not that it really matters to me at this point, as I have managed to fight my way through it.
Still, the original post I think remains unanswered. Is there a tutorial anywhere?
Regards,
jimmo
RE: Tutorial on setting up FCKEditor and PHP
like the following example:
web root /
siteroot /site/
FCKeditor /site/lib/FCKeditor/
Cnfigpath /site/themes/blue/css/
Cnfigpath /site/themes/blue/js/