解答|问题
1.'功能: 过虑HTML字符
'输入:字符串
'输出:经格式化后的字符串
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32)&CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")
HTMLEncode = fString
end if
end function
2.分页类
'参数:系统(如:product,article),条件(如果是数值,则默认为categoryID的值),排序,
'每页显示记录数,模式(more:显示更多字样,page:显示翻页导航),
'翻页导航模式(number:显示数字,page:显示上一页,下一页),记录显示模版名(显示记录的过程名)
class List
dim p_system'系统表,如tblProduct,tblArticle
dim p_where'条件
dim p_orderBy'排序
dim p_recordCount'每页显示记录数
dim p_horizontal'每行显示记录数
dim p_mode'列表模式,参数:more(更多模式,显示更多字样),page(列表模式,显示翻页导航)
dim p_moreURL'更多模式时的URL
dim p_paginationMode'翻页导航模式,参数:number(数字导航,显示如:1,2,3,4),page(翻页导航,显示如:上一页,下一页)
dim p_models'列表模版过程
dim p_table'列表的table标签
dim p_page'页码
dim p_member'是否显示会员产品
dim p_groupWhere
Private Sub Class_Initialize
p_system=""
p_where=""
p_orderBy=" order by categoryID,orderBy,postdate"
p_recordCount=15
p_horizontal=4
p_mode=""
p_moreURL=""
p_paginationMode="page"
p_models=""
p_table="<table width=100% border=0 align=center cellpadding=0 cellspacing=0 bordercolor=#CCCCCC style='border-collapse: collapse'>"
p_page=1
p_member=false
p_groupWhere="groupID=0"
End Sub
Property Let system(value)
p_system=value
end property
Property Let where(value)
if isInt(value) then
p_where=" where categoryID="&value
else
p_where=" where ("&value&")"
end if
end property
Property Let orderBy(value)
p_orderBy=" order by "&value
end property
Property Let recordCount(value)
p_recordCount=value
end property
Property Let horizontal(value)
p_horizontal=value
end property
Property Let mode(value)
p_mode=value
end property
Property Let moreURL(value)
p_moreURL=value
end property
Property Let paginationMode(value)
p_paginationMode=value
end property
Property Let models(value)
p_models=value
end property
Property Let table(value)
p_table=value
end property
Property Let page(value)
if getNumeric(value)<1 then
p_page=1
else
p_page=int(value)
end if
end property
Property Let member(value)
p_member=value
if p_member then
authorizationID=getValue("tblMember","authorizationID","memberID="&session("memberID"))
if authorizationID="" or authorizationID=0 then
authorizationID=getValue("tblGroup","authorizationID","groupID="&session("groupID"))
end if
virtual=getValue("tblAuthorization","virtual","authorizationID="&authorizationID)
authArr=split(virtual,",")
for i=0 to ubound(authArr)
if i=0 then
p_groupWhere="groupID="&getValue("tblGroup","groupID","authorizationID="&authArr(i))
else
p_groupWhere=p_groupWhere&" or groupID="&getValue("tblGroup","groupID","authorizationID="&authArr(i))
end if
next
else
p_groupWhere="groupID=0"
end if
end property
'列表过程
public sub List()
dim rs
dim where
if p_where="" then
where=" where "&p_groupWhere&" and publish=1"
else
where=p_where&" and ("&p_groupWhere&") and publish=1"
end