#native_company# #native_desc#

Replace a Text Are Field with a WYSIWYG editor in a browser

By Bill Rogers
on December 21, 2000


Type: Function

Category: HTML

License: WebSite Only

Description: Ektron’s eWebEditPro for PHP
Easily replaces a HTML text area field with a WYSIWYG editor, so content contributors can create and publish their own Web content while Webmasters and IT professionals maintain control over a Web site’s look and feel. We provide sample PHP code for a mini content manager.

Example and 30 day free download  http://www.ektron.com/php

Integrating eWebEditPro with PHP 

Ektron provides sample code to simplify the integration of eWebEditPro with PHP. You can insert eWebEditPro into an PHP page just as easily as you can insert a text area field into an HTML page.  Download a 30 day trial of eWebEditPro (including the sample code).

The following instructions explain how to insert eWebEditPro into a PHP page.

Integrating eWebEditPro in PHP Page

To place eWebEditPro on a PHP page, it must contain these actions:

1) Include the ewebeditpro.php file.                       
2) Set up a form.                       
3) Place the editor on the form.                       
4) Add a submit button.
Include a Reference to ewebeditpro.php

Your PHP page must include a reference to the ewebeditpro.php file. Place the #Include line within the pages head tags. 


<?php include("../../../ewebeditpro/ewebeditpro.php"); ?>

Set Up a Form

When setting up a form, follow these steps.

Declare a form.                                           
Enter a URL as the action. The URL defines the page that manipulates the users input when the user presses the submit button.                                            
Enter "Post" as the method.
Here is a sample form declaration:

<form action="multiedit.php?preview" method="POST">

Place the Editor on the Form

To place the editor on a PHP page, enter a line with the following elements within the form tags:

<?php echo eWebEditProEditor("field name", width, height,"$initial_content",wddx); ?>

field name  
Enter the name of the field that stores content within quotes (" "). It does not matter what the name is, but the field name on the page that retrieves the content must match this name. 

width, height  
Enter the width and height of the editor in percent or pixels. 
If a percent, enclose the value in quotes (" ") and follow it with a percent sign (%), for example 50%. If pixels, quotes are optional, for example, 500. 

initial content  
If you want some text to appear in the editor the first time a user views it, you can enter text or a variable that contains the text.
To enter text, enclose it within quotes (" "). 
To enter a variable, define it elsewhere in the file. 

Fonts, hyperlinks and image list. 

Here is an example of a line that calls the editor. (In this example, the initial content is defined in the variable strContent1, which is defined elsewhere in the file).

<?php echo eWebEditProEditor("TextHTML1", "100%", 250, strContent1,wddx); ?>

 Add a Submit Button

Add a standard HTML submit button that allows the user to send the content to the Web server after entering it. Here is an example of a line that contains a submit button.

<input type="submit" name="btnSubmit" value="Preview">
For manuals and more information: