Class Template
Private m_FileName
Private m_ValueList
Private m_RegExp
Private Sub Class_Initialize
Set m_ValueList = CreateObject("Scripting
Set m_BlockList = CreateObject("Scripting
set m_RegExp = New RegExp
m_RegExp
m_RegExp
m_FileName = ""
m_Root = "
m_Unknowns = "remove"
m_LastError = ""
m_HaltOnErr = true
End Sub
Private Sub Class_Terminate
Set m_RegExp = Nothing
Set m_BlockMatches = Nothing
Set m_ValueMatches = nothing
End Sub
Public Property Get ClassName()
ClassName = "Template"
End Property
Public Property Get Version()
Version = "
End Property
Private Function LoadFile(ByVal chartype)
Dim Filename
Filename = m_Root
If Right(Filename
Filename = Server
Set StreamObject = Server
StreamObject
StreamObject
StreamObject
StreamObject
StreamObject
StreamObject
StreamObject
StreamObject
LoadFile = StreamObject
If LoadFile = "" Then ShowError("
End Function
Private Sub ShowError(ByVal msg)
m_LastError = msg
Response
If m_HaltOnErr Then Response
End Sub
Public Sub set_root(ByVal Value)
m_Root = Value
End Sub
Public Function get_root()
get_root = m_Root
End Function
Public Property Let Root(ByVal Value)
set_root(Value)
End Property
Public Property Get Root()
Root = m_Root
End Property
Public Sub set_file(ByVal handle
m_FileName = filename
m_BlockList
End Sub
Public Function get_file()
get_file = m_FileName
End Function
Public Sub set_unknowns(ByVal unknowns)
m_Unknowns = unknowns
End Sub
Public Function get_unknowns()
get_unknowns = m_Unknowns
End Function
Public Property Let Unknowns(ByVal unknown)
m_Unknowns = unknown
End Property
Public Property Get Unknowns()
Unknowns = m_Unknowns
End Property
Public Sub set_block(ByVal Parent
Dim Matches
m_RegExp
If Not m_BlockList
set Matches = m_RegExp
For Each Match In Matches
m_BlockList
m_BlockList
Next
set Matches = nothing
End Sub
Public Sub set_var(ByVal Name
Dim Val
If IsNull(Value) Then Val = "" Else Val = Value
If m_ValueList
If AppEnd Then m_ValueList
Else m_ValueList
Else
m_ValueList
End If
End Sub
Public Sub unset_var(ByVal Name)
If m_ValueList
End Sub
Private Function InstanceValue(ByVal BlockTag)
Dim keys
InstanceValue = m_BlockList
keys = m_ValueList
For i=
InstanceValue = Replace(InstanceValue
Next
End Function
Public Sub parse(ByVal Name
If Not m_BlockList
If m_ValueList
If AppEnd Then m_ValueList
Else m_ValueList
Else
m_ValueList
End If
End Sub
Private Function finish(ByVal content)
Select Case m_Unknowns
Case "keep" finish = content
Case "remove"
m_RegExp
finish = m_RegExp
Case "comment"
m_RegExp
finish = m_RegExp
Case Else finish = content
End Select
End Function
Public Sub output(ByVal Name)
If Not m_ValueList
Response
End Sub
End Class
From:http://tw.wingwit.com/Article/program/net/201311/14039.html