Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Fields  /  Editor

Editor
Editor (
string $title
string $name
mixed $validator = null,
string $path = null,
string $toolbar = "Default",
string $skin = "default",
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/FCKeditor/fckconfig.js file.
$skin The skin used for the toolbar (the style of the buttons etc.). You can use "default", "silver" or "office2003".

This argument has been added since version RC2 and the argument $path has been moved one place forward, before $toolbar.
$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/FCKeditor/fckconfig.js file. The array key has to be the config var name. Example:
<?php
$config 
= array(
  
"StartupFocus" => true
);

?>


This function was added in FH3 v1.2.

Description:

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

The Editor is compatible with most internet browsers which include: IE 5.5+, Firefox 1.0+, Mozilla 1.3+ and Netscape 7+.
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 FCKeditor 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/FCKeditor/fckconfig.js and after defining it you can use it as argument.

Since version RC2 the argument skin is available. Also is the argument path moved 1 place forward, before toolbar.

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:50

Comments

Mels van Kooten 24 April 05 / 13:52  
This is an example of a home made menu.


FCKConfig.ToolbarSets["MyMenu"] = [    ['Undo','Redo','-','Cut','Copy','Paste','PasteText','PasteWord','-','Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','-','Link','Unlink','-','SpecialChar']
] ;



Just make your own menu's in the FH3\FHTML\FCKeditor\fckconfig.js file.
Go to line 68 and you'll see the existing menu's ;)

This example is used by formhandler like this:
<?php

$form
->editor("Message""message"null'images/'"MyMenu");
?>

Johan Wiegel 26 June 08 / 19:45  
In order to let a user delete files in the filebrowse function of FCKEditor.

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

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