ASP FAQs and Answers (5)

Source: Internet
Author: User
Tags chr
Solution | Question 1. ' Function: Misplaced HTML characters
' Input: String
' Output: Formatted string
function HTMLEncode (fstring)
If not IsNull (fstring) Then
fstring = replace (fstring, ">", ">")
fstring = replace (fstring, "<", "<")

fstring = Replace (fstring, CHR () &AMP;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 (a) & CHR (a), "</P><P>")
fstring = Replace (fstring, CHR (), "<BR>")

HTMLEncode = fstring
End If
End Function



2. Page-type
' Parameters: System (such as: product,article), condition (if it is numeric, default to CategoryID value), sorted,
' Show number of records per page, mode (more: Show more words, page: Show page navigation),
' Page navigation mode (number: Show numbers, page: Show previous page, next page), record display template name (the procedure name that displays the record)
Class List
Dim P_system ' system tables, such as Tblproduct,tblarticle
Dim P_where ' Condition
Dim P_orderby ' Sort
Dim P_recordcount ' shows the number of records per page
Dim P_horizontal ' shows the number of records per line
Dim P_mode ' list Mode, parameters: More (more mode, show more words), page (list mode, show page navigation)
Dim p_moreurl ' More Mode URL
Dim p_paginationmode ' page Navigation mode, Parameters: number (digital navigation, display such as: 1,2,3,4), page (page navigation, display such as: previous page, next page)
Dim p_models ' list template process
Table Label for Dim p_table ' list
Dim P_page ' Page Number
Dim P_member ' Show Member Products
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 (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=" &AMP;AUTHARR (i) )
End If
Next
Else
P_groupwhere= "Groupid=0"
End If
End Property

' List process
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



Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.