Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Fields  /  Editor

(Since version FH3 v.1.3)

Editor
Editor (
string $title
string $name
mixed $validator = null,
string $path = null,
string $toolbar = Default,
string $skin = v2,
integer $width = 720,
integer $height = 400,
array $config = array() 
)

Arguments:

Name Description
$title Title of the field
$name Name of the field
$validator This can either be the name of your own validation function or the constant name of a predefined validator function. For more information about validators see Validators.
It is also possible to use a method as a validation function. In this case you should pass an array where the first item is the object and the second item the name of the method.
$path The path where images can be browsed and uploaded. This directory will also be used for browsing for links, flash files and other media.
Set to false if you want to disable this feature.

The path has to be a relative path from the dir where your script is located. Don't use complete paths like this: /home/sites/etc/.
The dir which is used for browsing should be located in or below the web root.
Example:

# correct!
- uploads
- /uploads
- uploads/
- ../uploads
- ./uploads
# wrong!
- /home/sites/site1234/web/uploads/
- http://www.mysite.com/uploads/
- C:\Program Files\apache\htdocs\uploads
$toolbar The toolbar which is shown. You can configure the toolbars in the FH3/FHTML/CKeditor/ckconfig.js file.
$skin The skin used for the toolbar (the style of the buttons etc.). You can use "v2", "kama" or "office2003".
$width The width of the editor in pixels
$height The height of the editor in pixels
$config In this array you can set some config values for the editor. You can overwrite the config vars defined in the FH3/FHTML/CKeditor/config.js file. The array key has to be the config var name. Example:
<?php
$config 
= array(
  
"contentsCss" => "cms.css"
);
?>


note:
The config var names for CKeditor differ from those of FCKeditor!

Description:

With this function you can generate a online Text Editor (CKEditor):

The Editor is compatible with most internet browsers which include: IE6+, Firefox3+, Safari 4+, Googel Chrome and Opers
Browsers which are not compatible with the Editor will see a normal TextArea.

Note: When submitting vary much data please dont use the FH_TEXT validator. The validator is to time/memory expensive and submitting will fail. For small and normal amounts of data you can just use FH_TEXT.

Make sure the path to CKeditor is correct. You can change the the path in the config file:
fh_conf('FH_FHTML_DIR', 'path/to/your/dir/FH3/FHTML/');


It is also possible to make your own toolbar for the editor. You can define this in the file FHTML/CKeditor/config.js and after defining it you can use it as argument.

For previous function with FCKeditor as WYSIWYG editor see: http://www.fh3.nl/manual/32/Editor.html

Example

<?php  

// include the class  
include('FH3/class.FormHandler.php');  

// make a new formhandler object  
$form = new FormHandler();  

// make the editor  
$form -> editor("Message""message"null"images/uploads/");  

// button beneath it  
$form -> submitButton("Save");  

// set the 'commit after form' function  
$form -> onCorrect("doRun");  

// send the form to the screen  
$form -> flush();  

// the function witch handles the code after the form  
function doRun$data )  
{  
    
// show the data  
    
return $data["message"];  
}  

?>

Preview image

preview image

Latest change: 11 July 11 / 09:54

Comments

Johan Wiegel 11 July 11 / 09:09  
In order to let a user delete files in the filebrowse function of CKEditor.

Make sure this function is protected before removing the die in the FHTML/filemanager/connectors/php/delete.php

Johan Wiegel 11 July 11 / 09:23  
In order to have CKeditor working in IE6 and IE7 you will need body tags arround your page!

Stefan 18 July 11 / 11:34  
In the Image-dialogwindow the uploadtab is gone.. I think this is an essential function. Is it possible to implement it also in the CK-editor?
Many thanks!

Johan Wiegel 24 August 11 / 15:54  
Use the browse server button to upload using the filemanager

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license