Integrating eWebEditPro with PHP
See http://www.ektron.com/php for more information and a 30 day free fully functional mini content management system.
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 for a mini content management system).
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.
5) Include a Reference to ewebeditpro.php
Your PHP page must include a reference to the ewebeditpro.php file. Place the #Include line within the page’s head tags.
<?php include("../../../ewebeditpro/ewebeditpro.php\"); ?>
Set Up a Form
When setting up a form, follow these steps.
1) Declare a form.
2) Enter a URL as the action. The URL defines the page that manipulates the user’s input when the user presses the submit button.
3) 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); ?>
1) 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.
2) 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.
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\">
Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.