ASP advanced article online Management Update (IV)

Source: Internet
Author: User
Tags format chr
Online ASP Advanced article online Management Update--The transformation of HTM code

Author: Beach Boy

In front of the article for you to introduce the online add and save, but if this is not enough, because a lot of the article itself with the HTM code must be fully displayed, rather than show its effect, which means that the HTM code must be transformed to enable it to specifically display its code, such as: <a href= "" > Hello </a> you do not want to show on the page that it is a connection, but rather display its code, which is like FrontPage directly in the editing page to write code, but FrontPage provides the function of transformation.
In the ASP, you can transform the specific HTM code, so that it can be displayed in a complete form, such as the general format of HTM <> and so on, there is the ASP display HTM code format to be converted to HTM code, such as in the ASP Chr (13) for carriage return, then it must be translated into <br&gt, because in addition to the content of the article when all the newline and space in the return to savearticle.asp after the code is expressed in ASP, so this time to convert it to the HTM code, the only way to make the article correctly displayed.
The following is the system of these code conversion procedures, in which I have detailed the note marked

Create a new file Articlechar.inc with the following details:
<%
"A function program is built into a group processing function in the subroutine process and is a stand-alone program that accepts arguments to execute a series of code statements, and returns the knot of the processed code statement directly to the user code.
function Htmlencode2 (str)
Dim result
Dim l
If IsNULL (str) Then
Htmlencode2= ""
Exit function
End If
L=len (str)
Result= ""
Dim i
For i = 1 to L
"To determine the contents of the return, and to include &LT;,&GT;,CHR (a), Chr (a), &AMP;,CHR (), Chr (9) for the corresponding conversion, such as CHR (13) into <br>; is the HTM code of carriage return
Select Case Mid (str,i,1)
Case "<"
Result=result+ "<"
Case ">"
result=result+ ">"
Case Chr (13)
result=result+ "<br>"
Case Chr (34)
result=result+ "" "
Case "&"
result=result+ "&"
Case Chr (32)
' Result=result+ ' "
If I+1<=l and i-1>0 then
If Mid (str,i+1,1) =CHR or mid (str,i+1,1) =CHR (9) or mid (str,i-1,1) =CHR (?) or mid (str,i-1,1) =CHR (9) Then
Result=result+ ""
Else
Result=result+ ""
End If
Else
Result=result+ ""
End If
Case Chr (9)
Result=result+ ""
Case Else
Result=result+mid (str,i,1)
End Select
Next
Htmlencode2=result
End Function
%>

After the article returned to the information processing, the article can be displayed normally, so the next section will show how to display the article, automatically generate the HTM page of the article.

Reprint please indicate the source http://asky.on.net.cn



Related Article

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.