Introduction

WysiwygPro is a set of PHP classes that you can use to display a rich HTML word processor on a web page (often called a WYSIWYG editor). It is designed to be used as an alternative to the textarea tag. Just like a textarea tag WysiwygPro does not provide methods for loading content from a database or for saving content to a database; what you do with WysiwygPro is entirely up to you. 

A quick example (version 3.x): 


// include the WysiwygPro class
include_once("wysiwygPro/wysiwygPro.class.php");

// create a new editor instance:
$editor = new wysiwygPro();

// configure the editor:

// give the editor a name
//(equivalent to the name attribute on a regular textarea):
$editor->name = 'myeditor';

// set the content to be edited
//(equivalent to the value attribute on an input element or the content of a regular textarea):
$editor->value = 'some HTML code';

// display the editor, the two paramaters set the width and height:
$editor->display('100%', '400');

?>

The editor should be displayed within an HTML form where you would normally have displayed a textarea. When the form is submitted you can retrieve the HTML code from the editor using the $_POST or $_GET super globals just like you would with a regular textarea or input. If you have not worked with form data in PHP before we suggest you read the PHP tutorial here: http://www.php.net/manual/en/tutorial.forms.php

The Editor PHP API Reference section and some of the other examples in this manual omit some of the code above for clarity. Using the above example as a guide much of the example code could be placed anywhere after $editor = new wysiwygPro(); and before $editor->display();

If you copy code directly from examples in this manual please be aware that you may need to alter any include paths.

When looking at the syntax for functions described in this manual refer to the following: 

boolean indicates that the following parameter should be true or false. 

string indicates that the following parameter should be a string 

int indicates that the following parameter should be in integer 

array indicates the following parameter is an array.

Parameters enclosed in square brackets are optional.