An ASP template class

Source: Internet
Author: User
An example of a template from a class to an instance
This class still has a lot of imperfections (such as efficiency), I hope we discuss together, master a lot of correct.
-----------------------------------------------------------------------
First, introduce the classes in asp:
Class object that requires version 5.
Like some object-oriented languages, the ASP also provides support for classes, but is functionally imperfect.
For the description used in this class:
Initialize Event: This event occurs when an instance of a class is created.
Private Sub Class_Initialize ()
Statement
End Sub
This event is similar to a constructor in C + + to construct an object that initializes the properties of some classes in this class.
How do I create an instance?
Dim X
Set X = New classname
At this point x is already an object of the Class_Initialize process.
A function (procedure) defined in a class is called a method of a class.
Specific details can be referred to:
Mytju.com/classfiles/tju001/vbs5.5.chm
-----------------------------------------------------------------------
Introduction to Template technology:
When you write a program (such as a message board), have you ever experienced the way of looping + tables?
This written program, both poor readability, and difficult to maintain code.
For example, to change the color of a table in the future, or to change the layout of the page (for example, change the location of the message),
Maybe all the code will be rewritten (the message board of course not, the big news system is troublesome).
And the purpose of template technology is to:
The Presentation Layer (page) is separated from the logical layer (code).
This is a paging file (that is, a template):
The following are the effects that have been resolved by the code file:
Perhaps you would ask, what about this? No more trouble?
Perhaps in the early writing, will increase the cycle, however, the latter as long as you replace the template file, is a
It's a brand-new result! In this process, the ASP's VBS script file is not subject to modification at all.
Further: The above parsing process is controlled by the VBS you write, so (theoretically) it can be parsed into
Any type of file, as long as there is a template!
So what do you think? Yes, Sina you can do it too! (exaggerated rhetoric) before making a news system,
The era of news.asp?id=xxx (read news by News ID) can be over, and you can generate static pages:
2004090618.htm.
To be honest, say template technology:
Template technology is simply to put the [template file] inside the variable to be replaced (here is the contents of {}),
Replace it with what you need to display.
Ordinary variable substitution is easy: you only need to understand the operation of the FSO (AD show: Cnbruce has an ASP tutorial, detailed explanation)
It's easy to read all the contents of the template file and replace the ' tag ' that you want to replace (replace ())
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.