Implement the UBB function of the forum with ASP

zhaozj2021-02-08  297

A few days I have read a technical article telling how to use the regular expression objects in VBScript to implement the UBB function in the forum. The regular expression object feature provided by VBScript is very powerful, but only 5.5 scripting engines can support the regular expression object, in order to get the version of 5.5, you need to install this scripting engine separately. Or install IE5.5, that is, the requirements for the server are more demanding, then there is no other way to implement the UBB function? Of course, not, now follow me to use a normal VBScript scripting language to implement powerful UBB features.

First, in the UBB function, the core function is the most attractive function is to fully support the control of the map function and font attribute. Because of the security reason, almost all forums above the network have fallen the HTML code as much as possible, so that people's intentional unintentional to the forum is destroyed, so although it guarantees the safety of the forum itself, but netizens Faced post content is always a constant color, font, size, and don't expect to see the colorful pictures. UBB code is born, specifically, how we implement the above UBB core functions.

Let's first describe in detail the syntax of the UBB code we will implement:

First, support the UBB grammar of the map

Grammar: [ivg] picture path [/ img]

Example: [img] http://www.coolbel.com/chinagusu/logo.gif [/ iv]

Description: The result of the above syntax is displayed on the web page.

Second, support the UBB syntax of font color:

Syntax: [red] text [/ red]

[green] text [/ green]

and many more

Example: [Blue] This is a blue text [/ blue]

Description: The above grammar is the text of a blue color

Third, support super connection UBB code

Syntax: [URL] Connection Address [/ URL]

Example: [URL] http://www.coolbel.com/chinagus [/ url]

Description: The result of the above syntax is to generate a super connection. When you click, it will turn to the address of the connection!

Fourth, support the UBB syntax of the Email address

Syntax: [email] Your email address [/ email]

Example: [email] uESTC95@263.net [/ email]

Description: The above code result is to display an email address. When you click on the mouse, you will automatically open the software that sends an email and write the address.

V. UBB grammar supporting font properties

Grammar: [b] a paragraph [/ b], etc.

Example: [b] a crude text [/ b]

Description: The result of the above code is to display a crude body

Ok, the core function of the UBB code is these things, of course, you can also add other features because this UBB code syntax can be customized.

Before we start specific UBB functions, let's first understand several important VBScript functions: Instr functions and replace functions. Maybe you can't help but want to say, this is too simple, huh, in fact, these two functions are indeed we use more frequent two functions in programming, but it also has its own little secret, we Let's take a look at the specific syntax of these two functions:

INSTR function

Returns a certain position in another string.

INSTR ([Start,] string1, string2 [, compare])

parameter

Start

Optional. Numerical expressions for setting the start position of each search. If you omit, you start searching from the location of the first character. If start

转载请注明原文地址:https://www.9cbs.com/read-1051.html

New Post(0)