Refresh | Register | Logon
Welcome:  Guest
 Posted by: Admin  Messages 
This would allow to display a list of the last few ads user viewed at your classified.

1. Place this right after: objConn.Execute("UPDATE " & tablPfx & "Ads SET adcounter = " & adcount & " WHERE adID = '" & adID & "';")

in viewad.asp:

===========================
'number of ads to remember
recentDspl = 5
savedList = Trim(Request.Cookies("RecentView" & strSUnique))
newAd = adID & chr(16) & sbg & s
On Error Resume Next
If Len(firstImage) > 0 then
recentImage = Split(firstImage, upload)(1)
recentImage = Split(recentImage, "'")(0)
Else: recentImage = "nopics.gif"
End If
On Error Goto 0
newItem = recentImage & chr(16) & newAd
If Len(savedList) = 0 then
Response.Cookies("RecentView" & strSUnique) = newItem
Else
If Instr(savedList, adID) = 0 then
savedArray = Split(savedList, s)
If Ubound(savedArray) = recentDspl then
For rl = 0 to recentDspl - 2
newList = newList & savedArray(rl) & s
Next
savedList = newList
End If
Response.Cookies("RecentView" & strSUnique) = newItem & savedList
End If
End If

=========================



2. Place this function into Libraries.asp:

=========================
Function showRecent()

myRecent = Request.Cookies("RecentView" & strSUnique)
If Len(myRecent) > 0 then
recentAdsStr = "<div align='center' style='margin: 3px;'>"
recentAdsStr = recentAdsStr & "<table width='98%' class='list_table' cellspacing=1 cellpadding=2 border=0>"
recentArray = Split(myRecent, s)
For rl = 0 to Ubound(recentArray) - 1
nextAr = Split(recentArray(rl), chr(16))
nextImage = nextAr(0)
nextAdID = nextAr(1)
nextSbg = nextAr(2)
If nextImage = "nopics.gif" then
nextImage = "img/" & nextImage
Else: nextImage = upload & nextImage
End If
If rl mod 2 = 0 then cellColor = "class='evencell'": Else: cellColor = "class='oddcell'"
recentAdsStr = recentAdsStr & "<tr " & cellColor & "><td><a href=viewad.asp?id=" & nextAdID & ">"
recentAdsStr = recentAdsStr & "<img src='" & nextImage & "' border=0 class=imgFrame width=30 height=25></a></td>"
recentAdsStr = recentAdsStr & "<td width='100%'><a href=viewad.asp?id=" & nextAdID & ">" & nextSbg & "</a></td></tr>" & vbcrlf
Next
recentAdsStr = recentAdsStr & "</table></div>"
showRecent = recentAdsStr
End If

End Function
===================


In footer.asp right before: If not sTarget = Empty then Application("Cat_List" & strUnique) = Empty

Place line: Response.Write showRecent

It should not necessary be a footer.asp. You may place <% Response.Write showRecent %> into any page where you feel it's a right spot to display recent. Do not place it into templates. If you'd like to place it into the portal boxes, place it directly into the header or footer replacing: Response.Write BuildContent(.... in the appropriate display box.

Feel free to modify Function showRecent() for the best visual output.
 Posted On: 6/18/2005 10:38:14 PM   Direct Link   
 Thread: Posted by: Posted On:
  Last 'N' displayed ads
Admin 6/18/2005 10:38:14 PM
cher 12/28/2005 10:31:36 PM
cher 12/28/2005 10:33:59 PM
cher 12/28/2005 10:42:19 PM
admin 12/28/2005 10:52:12 PM