Refresh | Register | Logon
Welcome:  Guest
Admin and Users Tips and Tricks::Total ads and user accounts (consolidated)::Search Forums
 Posted by: admin  Messages 
You can display total number of ads/users on any page as well as include it into Email, Newsletter and Main page templates.

1. Add the following function to libraries.asp

---------------------------------------------------
Function totalContent(content_type)
Select Case content_type
Case "users": strSQL = "SELECT ID FROM " & tablUPfx & "User;"
Case "ads": strSQL = "SELECT ID FROM " & tablPfx & "Ads WHERE status = 1;"
Case Else: Exit Function
End Select
set rst = objConn.Execute(strSQL)
If not rst.EOF then
rstdata = rst.getrows
totalContent = UBound(rstdata,2) + 1
Else: totalContent = 0
End If
rst.close
End Function
---------------------------------------------------

2. To display total number of ads insert <%= totalContent("ads") %> to your page.
To display total number of users insert <%= totalContent("users") %> to your page.

3. To have it in a Main page Template, come up with a variable name to include in the template. For instance :postedads: or :allusers:

Now you need to modify the default page and substitute variables with the actual number of ads/users.

Place following line(s) Before [Response.Write strbody]

strbody = Replace(strbody, ":postedads:", totalContent("ads"))
'and/or
strbody = Replace(strbody, ":allusers:", totalContent("users"))


4. To have it in an Email/Newsletter, identical replacement must take place in mailmodule.asp. At the top of the page where other variables are replaced include those lines to the bunch:

templRec = Replace(templRec, ":postedads:", totalContent("ads"))
strbody = Replace(strbody, ":postedads:", totalContent("users"))
 Posted On: 9/10/2005 10:24:19 PM   Direct Link   
 Thread: Posted by: Posted On:
  Total ads and user accounts (consolidated)
admin 9/10/2005 10:24:19 PM
Floyd 2/8/2006 3:40:19 PM
admin 2/8/2006 6:21:19 PM
Floyd 2/10/2006 10:27:47 AM
Dan 6/27/2006 10:39:58 AM
admin 6/27/2006 3:07:22 PM
Dan 6/28/2006 2:28:14 AM
admin 7/3/2006 2:47:35 AM
Dan 7/14/2006 11:20:24 AM
murry_c 12/31/2007 5:20:42 PM
admin 12/31/2007 6:51:45 PM
murry_c 12/31/2007 11:35:11 PM
admin 1/1/2008 1:40:32 PM
murry_c 1/1/2008 6:16:04 PM
admin 1/2/2008 1:23:22 AM