(New page: It is very easy to use FCKeditor in your ASP web pages. All the integration files are available in the official distributed package. Just follow these steps. == Integration step by step =...) |
|||
Line 31: | Line 31: | ||
The complete sample - find the full sample in your Samples directory. | The complete sample - find the full sample in your Samples directory. | ||
− | <pre> | + | <pre><!-- #INCLUDE file="../../fckeditor.asp" --> |
− | + | <html> | |
− | + | <head> | |
− | + | <title>FCKeditor - Sample</title> | |
− | + | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
− | + | </head> | |
− | + | <body> | |
− | + | <form action="sampleposteddata.asp" method="post" target="_blank"> | |
− | |||
− | + | <% | |
' Automatically calculates the editor base path based on the _samples directory. | ' Automatically calculates the editor base path based on the _samples directory. | ||
' This is usefull only for these samples. A real application should use something like this: | ' This is usefull only for these samples. A real application should use something like this: | ||
− | ' oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. | + | ' oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. |
Dim sBasePath | Dim sBasePath | ||
Line 52: | Line 51: | ||
Dim oFCKeditor | Dim oFCKeditor | ||
Set oFCKeditor = New FCKeditor | Set oFCKeditor = New FCKeditor | ||
− | oFCKeditor.BasePath = sBasePath | + | oFCKeditor.BasePath = sBasePath |
− | oFCKeditor.Value = " | + | oFCKeditor.Value = "<p>This is some <strong>sample text</strong>. You are using <a href=""http://www.fckeditor.net/"">FCKeditor</a>." |
oFCKeditor.Create "FCKeditor1" | oFCKeditor.Create "FCKeditor1" | ||
+ | %> | ||
+ | |||
+ | <br /> | ||
+ | <input type="submit" value="Submit" /> | ||
+ | </form> | ||
+ | </body> | ||
+ | </html> | ||
+ | </pre> | ||
+ | |||
+ | == Handling the posted data == | ||
+ | |||
+ | The editor instance just created will behave like a normal <INPUT> field in a form. To retrieve its value you can do something like this: | ||
+ | <pre> | ||
+ | <% | ||
+ | Dim sForm | ||
+ | For Each sForm in Request.Form | ||
%> | %> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> |
Revision as of 13:54, 3 January 2008
It is very easy to use FCKeditor in your ASP web pages. All the integration files are available in the official distributed package. Just follow these steps.
Contents
[hide]Integration step by step
Step 1
Suppose that the editor is installed in the /FCKeditor/ path of your web site. The first thing to do is to include the "ASP Integration Module" file in the top of your page, just like this:
<!-- #INCLUDE file="../../fckeditor.asp" -->
Step 2
Now the FCKeditor is available and ready to use. So, just insert the following code in your page to create an instance of the editor (usually inside a <FORM>):
<% Dim sBasePath sBasePath = Request.ServerVariables("PATH_INFO") sBasePath = Left( sBasePath, InStrRev( sBasePath, "/_samples" ) ) Dim oFCKeditor Set oFCKeditor = New FCKeditor oFCKeditor.BasePath = sBasePath oFCKeditor.Value = "<p>This is some <strong>sample text</strong>. You are using <a href=""http://www.fckeditor.net/"">FCKeditor</a>." oFCKeditor.Create "FCKeditor1" %>
"FCKeditor1" is the name used to post the editor data on forms.
Step 3
The editor is now ready to be used. Just open the page in your browser to see it at work.
Sample Code
The complete sample - find the full sample in your Samples directory.
<!-- #INCLUDE file="../../fckeditor.asp" --> <html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form action="sampleposteddata.asp" method="post" target="_blank"> <% ' Automatically calculates the editor base path based on the _samples directory. ' This is usefull only for these samples. A real application should use something like this: ' oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. Dim sBasePath sBasePath = Request.ServerVariables("PATH_INFO") sBasePath = Left( sBasePath, InStrRev( sBasePath, "/_samples" ) ) Dim oFCKeditor Set oFCKeditor = New FCKeditor oFCKeditor.BasePath = sBasePath oFCKeditor.Value = "<p>This is some <strong>sample text</strong>. You are using <a href=""http://www.fckeditor.net/"">FCKeditor</a>." oFCKeditor.Create "FCKeditor1" %> <br /> <input type="submit" value="Submit" /> </form> </body> </html>
Handling the posted data
The editor instance just created will behave like a normal <INPUT> field in a form. To retrieve its value you can do something like this:
<% Dim sForm For Each sForm in Request.Form %>