|
Using EditLive! with Single Web Files via FTPEphox, July 2001 ContentsIntroduction IntroductionThis article outlines how to integrate EditLive! 4.0 into your own HTML page for use with single Web files on a remote server via FTP. Client-side JavaScript is used to create and customize the EditLive! object. Using EditLive! with Single Web Files via FTPEditLive! is designed for use with single files from an FTP server, using FTPStandard mode. This mode works by loading the specified page directly into EditLive! from the remote server. When the changes have been made, and the page has been saved back to the remote server, the modifications are available for viewing immediately on the Web site. This eliminates the need for the cumbersome task of downloading and uploading files to the remote Web server. Examples of where this mode may be applied include the administration area of a business Web site where end users can create and manage the content of an intranet or a Web site service, from an ISP or Web host which allows subscribers to edit their personal Web pages online. Getting StartedBefore You Integrate EditLive!Before you integrate EditLive! you should have viewed the online demos at www.ephox.com and have downloaded and installed the latest Ephox EditLive! 4.0 Development Kit. You should then copy the entire editlive folder to your web server. This folder is installed with the EditLive! 4.0 Development Kit. Prerequisite SkillsPlease ensure you have read Integration Basics before using this sample. Integrating EditLive!The following steps should be carried out to integrate EditLive! into an existing HTML page using HTMLString mode:
Step 1 - Include External Script FilesPlace the SCRIPT tags linking these files to your page in the HEAD section of your Web page.
Step 2 - Insert a SCRIPT blockInsert a SCRIPT block at the location in your HTML page where you want EditLive! to appear.
Step 3 - Configure Global VariablesConfigure the global variable, setDownloadDirectory, to where the EditLive! installation files (the "editlive" folder) can be found.
For more information about configuring global variables refer to The EditLiveGlobal object. Step 4 - Create an EditLive ObjectCreate an instance of EditLive! in your HTML page by using the JavaScript API to create a new "EditLive" JavaScript object.
Step 5 - Set EditLive!'s PropertiesName the onload function which will be used to initialize and customize the EditLive! object.
Then, use this function to define the initial properties and methods of the EditLive! object. In this case, the EditLive! mode must be set to 'FTPStandard'. In FTP Standard mode, it is also important to set all of the FTP settings so that EditLive! can interact with the web server to retrieve and save the desired file. FTP settings include:
To load a file into EditLive, the loadFile method is called with the desired filename as the argument. To create a new file within EditLive!, the newFile method is called instead. The WebRoot also needs to be specified. This is used to complete any relative addresses included in the content created within EditLive!. For this reason it needs to reflect the absolute URL of the working folder where the web file within EditLive! resides. For a full list of the EditLive! properties and methods available, please see the EditLive! reference section.
Putting It All TogetherPutting all the steps together results in the HTML code shown below.
Saving the FileWhen using EditLive! in FTPStandard mode, a Save button is available on the EditLive! toolbar. This allows the user to save the file back to the remote web server. If you would prefer to include a separate Save button in the HTML page, this can be easily achieved using the EditLive! saveFile method. This method performs exactly the same function as the Save button on the EditLive! toolbar.
Next StepsTo see some specific examples of how to integrate EditLive! into a variety of applications please see the advanced samples for specific platforms.
|
|
|||||||||||||||||||||||||||||||||||||||||||
| Copyright © 1999-2005 Ephox Corporation. All Rights Reserved. 'Ephox' is a registered trademark of Ephox Corporation. Java and the Java Powered logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. |