About through the VBS class processing template to achieve code and interface separation procedures, recommended into the essence for future reference. Have a demo
Source: Internet
Author: User
Article title: VBS class processing template implementation code and interface separation
' Author: Yanek
' Email:aspboy@263.net
This program through the VBS class processing template to achieve code and interface separation of the program, mainly the following file composition
Index.asp,parse_cls.asp,template.html
Here is the code
1. Index.asp call the VBS class process template
<%
' Author: Yanek
' Email:aspboy@263.net
'--- ---
' Index.asp
'------ ----
' (c) James Q. Stansfield (james.stansfield@iridani.com)
' This code was free for use by anyone. It is meant as a learning tool and can are passed along in any format.
Option Explicit
%>
<!--#INCLUDE file= "parse_cls.asp"-->
<%
' Declare Our variables
Dim G_opagegen
' Cerate the Class object
Set G_opagegen = New Parsetmpl
' Set the template file
G_opagegen.templatefile = "Template.html"
' Add Some custom tags to the dictionary
G_opagegen.addtoken "title", "Template Example"
G_opagegen.addtoken "Copyright", "This is mine! All mine! "
G_opagegen.addtoken "Quote", "" "" Tell Jabba I ' ve got his money! "" <br>--han Solo, Star Wars 1977 "
G_opagegen.addtoken "Menu", "Home page<br>news page<br>link Page"
G_opagegen.addtoken "Content", "Welcome to my home Page ... yadda yadda yadda! "
' Generate the page
G_opagegen.generatehtml
' Destroy our objects
Set G_opagegen = Nothing
%>
2. Parse_cls.asp Processing template class files
<%
' Author: Yanek
' Email:aspboy@263.net
'--- ---
' Parse_cls.asp
' This code was free for use by anyone. It is meant as a learning tool and can are passed along in any format.
Class Parsetmpl
' Dimension variables
Private G_stmplfile
Private G_odict
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.