Instructions for using ewebeditor [reprint]

Source: Internet
Author: User

Disclaimer: This article is not written by me. It is written in space to facilitate reading and organizing materials. The copyright of the article belongs to the original author.

Installation:

It is very easy to install. The first thing you need to do is upload the ewebeditor file to your website. follow these steps:

  1. Download the latest version from the ewebeditor product website.
  2. Decompress the downloaded compressed file to your local machine (make sure that the directory file structure level in the ewebeditor is consistent with that in the compressed file ).
  3. Create a new folder on your site, such as/ewebeditor/(it is best to make it easier to call under the desired directory ).
  4. Upload all files and directories of the ewebeditor to the folder created on your site.
  5. Run the example file (http://www.yoursite.com/ewebeditor/example/test.asp) to see if it works properly. OK.

Settings:

The ewebeditor provides the background management function, allowing you to easily manage styles and upload files. Note:

  • Admin Logon address: http://www.yoursite.com/ewebeditor/admin_login.asp
  • For the first installation, use the default user admin and password admin to log on to the background and go to the Management page to change the management user and password.
  • We recommend that you change the database name after installation to prevent malicious downloads. The default data name is dB/ewebeditor. MDB. Modify the connection in the include/startup. asp file after the name is changed.
  • The system has several standard styles that cannot be modified. When you add a style, you 'd better preview it first, and then use the "Copy standard style" method to quickly add a style, not prone to errors

Call:

The call of ewebeditor is very simple, basically just adding a line of code in the original use.

Standard call:

<IFRAME id = "ewebeditor1" src = "/ewebeditor. asp? Id = content1 & Style = standard "frameborder =" 0 "scrolling =" no "width =" 500 "Height =" 350 "> </iframe>

Parameter description:

  • /Ewebeditor. asp should be changed to the actual installation path
  • Parameter ID: the name of the associated form item, that is, the name of the form item to be referenced on the submit and save page. Make sure that the ID is different for multiple calls. See the following example.
  • Style: The style name used. It can be a standard style name or a custom style name. If the standard style is used, leave it blank.
  • Width, height: according to actual needs, ewebeditor will automatically adjust and adapt
  • In the background management, you can get the best call code for each style

All entry parameters: (that is, ewebeditor. asp? Parameters)

  • ID: The name of the associated form item that saves the edited content, that is, the name of the form item to be referenced on the submit save page.
  • Style: The name of the style to use. It can be a standard style name or a custom style name. If you use a standard, leave it blank.
  • Originalfilename: The name of the form item associated with the list of stored and uploaded original file names. It must be of the input type and can contain the onchange event [Example]
  • Savefilename: The name of the associated form item for saving, uploading, and saving the file name list. It must be of the input type and can contain the onchange event [Example]
  • Savepathfilename: The name of the form item associated with the file name (with Path) for saving, uploading, and saving the file name (with Path) list. It must be of the input type and can contain the onchange event [Example]

Example: Add a form

You may have been:

<Textarea name = "content1" rows = 10 Cols = 50> </textarea>

Now:

<Input type = "hidden" name = "content1" value = "">
<IFRAME id = "ewebeditor1" src = "/ewebeditor. asp? Id = content1 & Style = standard "frameborder =" 0 "scrolling =" no "width =" 500 "Height =" 350 "> </iframe>

Or

<Textarea name = "content1" style = "display: none"> </textarea>
<IFRAME id = "ewebeditor1" src = "/ewebeditor. asp? Id = content1 & Style = standard "frameborder =" 0 "scrolling =" no "width =" 500 "Height =" 350 "> </iframe>

Example: modify a form

You may have been:

<Textarea name = "content1" rows = 10 Cols = 50> <% = server. htmlencode (ORS ("d_content") %> </textarea>

Now:

<Input type = "hidden" name = "content1" value = "<% = server. htmlencode (ORS (" d_content ") %>">
<IFRAME id = "ewebeditor1" src = "/ewebeditor. asp? Id = content1 & Style = standard "frameborder =" 0 "scrolling =" no "width =" 500 "Height =" 350 "> </iframe>

Or

<Textarea name = "content1" style = "display: none"> <% = server. htmlencode (ORS ("d_content") %> </textarea>
<IFRAME id = "ewebeditor1" src = "/ewebeditor. asp? Id = content1 & Style = standard "frameborder =" 0 "scrolling =" no "width =" 500 "Height =" 350 "> </iframe>

Note:

  • Ewebeditor allows multiple IDs in the same form, but ensure that IDs are unique throughout the web page. That is, if you have used input name = content1, the second call requires input name = content2.
  • When textarea is used as the original form item, style = "display: none" must be added ".
  • You must use value = "" instead of value = ''when modifying input ''.
  • You must use server. htmlencode () when adding value values dynamically. Otherwise, the content may be truncated.
  • <% @ Page Language = "C #" autoeventwireup = "true" codefile = "ewebeditor. aspx. CS "inherits =" admin_ewebeditor "validaterequest = false %> set this parameter to false and disable verification so that the document can be submitted smoothly.

Advanced call:

Ewebeditor also provides some advanced calling methods, such as the following, but make sure that they are in the same case:

  • Gethtml (): returns the content of the editor.
  • Sethtml (HTML): Set the editor content
  • Inserthtml (HTML): insert content to the current selection
  • Appendhtml (HTML): Append content to the end of the document
  • Setmode (newmode): changes the current editing status
    Newmode:
    • "Code": code status
    • "Edit": editing status
    • "Text": Text status
    • "View": preview status

Example :[Online Demo]

<Script language = JavaScript>
// Retrieve the editor content
VaR shtml = ewebeditor1.gethtml ();
// Set the editor content
Ewebeditor1.sethtml ('<B> hello my world! </B> ');
// Insert in the current selection
Ewebeditor1.inserthtml ('this is insert function! ');
// Append content to the end
Ewebeditor1.appendhtml ('this is append function! ');
// Change the editor status to the code editing status
Ewebeditor1.setmode ('code ');
</SCRIPT>

Value description:

Because ewebeditor automatically processes large forms, the values vary, as shown in the following code:

It turns out to be

<%
Scontent = request. Form ("content1 ")
%>

Now yes

<%
For I = 1 to request. Form ("content1"). Count
Scontent = scontent & request. Form ("content1") (I)
Next
%>

Interface: pop-up call description:

V2.7.5 is added with the pop-up window call interface Extension function, which enables opening the editor through a link pop-up window and saving the edited content to the specified form field.

In the root directory of ewebeditor, the file name is Popup. asp. The interface input parameters are as follows:

  • Style: style name
  • Form: Form name to return or set the value
  • Field: name of the form item textarea to return or set the value

Example :[Online Demo]

<HTML>
<Body>
<Script language = JavaScript>
Function ewebeditorpopup (style, form, field ){
VaR opopup = Window. Open ("Popup. asp? Style = "+ style +" & form = "+ form +" & field = "+ field," popup "+ form + field," toolbar = No, location = No, directories = No, status = Yes, menubar = No, scrollbars = Yes, resizable = yes ");
}
</SCRIPT>
<Form action = "" method = "" name = "myform">
<Textarea name = "myfield" Cols = "50" rows = "5"> </textarea>
<Input type = "button" value = "HTML edit" onclick = "ewebeditorpopup ('s _ popup ', 'myform', 'myfield')">
</Form>
</Body>
</Html>

Interface: foreground explanation (Restriction) Extended Function Description:

This function disables some tags, such as SCRIPT tags for security reasons. Different versions may vary. See the description in the actual file:

    Function ewebeditor_decode (s_content, sfilters)

  • S_content: The data string to be converted.
  • S_filters: format set to be filtered out. Multiple Format sets are separated by commas (,).

Example:

The extension file is included first, and the following path is changed accordingly.
<! -- # Include file = "include/decode. asp" -->

<%
'In this example, only the script tag is filtered, which means that the client script in the content will not take effect. You can add other tags as needed.
Scontent = ewebeditor_decode (scontent, "script ")
%>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.