g
set objRegEx = nothing
processcustomtag = scontent
end function
function X_processcustomtag(byval scontent)
dim objRegEx,match,matches
set objRegEx = new RegExp
objRegEx.pattern = "(\[ncms:).+?(\])(.|\n)+?(\[\/ncms\])"
objRegEx.ignorecase = true
objRegEx.global = true
set matches = objRegEx.execute(scontent)
for each match in matches
scontent = replace(scontent,match.value,parsetag(match.value))
next
set matches = nothing
set objRegEx = nothing
X_processcustomtag = scontent
end function
function getattribute(byval strattribute,byval strtag)
dim objRegEx,matches
set objRegEx = new RegExp
objRegEx.pattern = lcase(strattribute)&"=""[0-9a-zA-Z]*"""
objRegEx.ignorecase = true
objRegEx.global = true
set matches = objRegEx.execute(strtag)
if matches.count > 0 then
getattribute = split(matches(0).value,"""")(1)
else
getattribute = ""
end if
set matches = nothing
set objRegEx = nothing
end function
function getinnerhtml(byval strhtml)
dim objregex,matches,str
set objregex = new regexp
objregex.pattern = "(\])(.|\n)+?(\[\/ncms\])"
objregex.ignorecase = true
objregex.global = false
set matches = objregex.execute(strhtml)
if matches.count > 0 then
str = trim(matches.item(0).value)
end if
set matches = nothing
if len(str) > 8 then
getinnerhtml = mid(str,2,len(str) - 8)
end if
end function
function parsetag(byval strtag)
dim arrresult,classname,arrattributes,objclass
if len(strtag) = 0 then exit function
arrresult = split(strtag,":")
classname = split(arrresult(1)," ")(0)
select case lcase(classname)
case "news"
set objclass = new ncmsnewstag
if not isnumeric(getattribute("id",strtag)) then
response.write("标签[ncms:news]参数错误!参数[id]必须是数字!")
response.end()
end if
objclass.id = getattribute("id",strtag)
if not isnumeric(getattribute("num",strtag)) then
response.write("标签[ncms:news]参数错误!参数[num]必须是数字!")
response.end()
end if
objclass.num = getattribute("num",strtag)
if not isnumeric(getattribute("len",strtag)) then
response.write("标签[ncms:news]参数错误!参数[len]必须是数字!")
response.end()
end if
objclass.len = getattribute("len",strtag)
objclass.show = getattribute("show",strtag)
if getattribute("lih",strtag) <> "" and not isnumeric(getattribute("lih",strtag)) then
response.write("标签[ncms:news]参数错误!参数[lih]必须是数字!")
response.end()
end if
objclass.lih = getattribute("lih",strtag)
if