在日常学习、工作或生活中,大家总少不了接触作文或者范文吧,通过文章可以把我们那些零零散散的思想,聚集在一块。范文怎么写才能发挥它最大的作用呢?以下是小编为大家收集的优秀范文,欢迎大家分享阅读。
asp程序代码篇一
class template
private m_filename, m_root, m_unknowns, m_lasterror, m_haltonerr
private m_valuelist, m_blocklist
private m_regexp
private sub class_initialize
set m_valuelist = createobject("nary")
set m_blocklist = createobject("nary")
set m_regexp = new regexp
case = true
= true
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 = "1.0"
end property
private function loadfile(byval chartype)
dim filename, fso, hndfile
filename = m_root
if right(filename, 1)<>"/" and right(filename, 1)<>"" then filename = filename & "/"
filename = h(filename & m_filename)
set streamobject = object("")
= 1
= 3
on = 0
omfile filename
on = 0
= 2
t = chartype
loadfile = xt()
if loadfile = "" then showerror("0x11
could not load the file " & m_filename & "!")
end function
private sub showerror(byval msg)
m_lasterror = msg
"error id : " & msg & ""
if m_haltonerr then
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,byval filename,byval chartype)
m_filename = filename
handle, loadfile(chartype)
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, byval blocktag, byval name)
dim matches
n = "([ss.]*)"
if not (parent) then showerror("0x12
undefined block tag " & parent & "!")
set matches = e((parent))
for each match in matches
blocktag, ches(0)
(parent) = replace((parent), , "{" & name & "}")
next
set matches = nothing
end sub
public sub set_var(byval name, byval value, byval append)
dim val
if isnull(value) then val = "" else val = value
if (name) then
if append then (name) = (name) & val _
else (name) = val
else
name, value
end if
end sub
public sub unset_var(byval name)
if (name) then (name)
end sub
private function instancevalue(byval blocktag)
dim keys, i
instancevalue = (blocktag)
keys =
for i=0 to -1
instancevalue = replace(instancevalue, "{" & keys(i) & "}", (keys(i)))
next
end function
public sub parse(byval name, byval blocktag, byval append)
if not (blocktag) then showerror("0x12
undefined block tag " & parent & "!")
if (name) then
if append then (name) = (name) & instancevalue(blocktag) _
else (name) = instancevalue(blocktag)
else
name, instancevalue(blocktag)
end if
end sub
private function finish(byval content)
select case m_unknowns
case "keep" finish = content
case "remove"
n = "{[^ trn}]+}"
finish = e(content, "")
case "comment"
n = "{([^ trn}]+)}"
finish = e(content, "")
case else finish = content
end select
end function
public sub output(byval name)
if not (name) then showerror("0x13
could not find tag " & name & "!")
(finish((name)))
end sub
end class
s("content_relate");【关于asp模板类代码参考】相关文章:
1.asp缓存类代码
2. 操作ini文件读写类实例代码
3.关于ajax类代码
4.asp购物车代码
5.asp分页代码是什么
6.asp加法验证码代码
7.关于asp技术简介参考
8. 组合模式的php代码

一键复制