%
'Articles System
'Subs:
'DisplayArticleNavigation Displays the Categories upper the actual category
'DisplayArticleCats Displays the cats under the actual category and the related forum
'DisplayArticles Displays the Links in the actual category
%>
<%
Public Sub DisplayArticleNavigation %>
|
<%
Dim arCatIDs()
Redim arCatIDs(1)
Set objRec2 = CreateObject("ADODB.Recordset")
Dim arCatTitles()
Redim arCatTitles(1)
Dim i
Dim ArraySize
CatID = Request.QueryString("catid")
If Request.QueryString("catid") = "" then
CatID = 0
End If
'Create a recordset with the top level categories in it.
strSQL = "SELECT ParentID, CatID, Title FROM FORUM_Site_Cats;"
Set objRec2 = my_Conn.Execute (strSQL)
i = 0
'Loop until the top level category is found.
DO UNTIL CatID = 0
'Create a filtered recordset with only one record.
objRec2.Filter = "CatID = " & CatID
arCatIDs(i) = objRec2("CatID")
arCatTitles(i) = objRec2("Title")
If NOT objRec2("ParentID") = 0 then
Redim Preserve arCatIDs(i+1)
Redim Preserve arCatTitles(i+1)
End If
CatID = objRec2("ParentID")
i = i + 1
LOOP
'It might be the top level in which case Home shouldn't be a link.
If NOT Request.QueryString("catid") = "" then
Response.Write "Home >> "
Else
Response.Write "Home >> "
End If
'The array holds the information in the wrong order so read it backwards.
For i = UBound(arCatIDs) to 0 Step - 1
If i = 0 then
Response.Write arCatTitles(i)
Else
'This is a stupid line of code. Remove it and see what happens to the first level of categories.
If NOT arCatIDs(i) = "" then
Response.Write ""&arCatTitles(i)&" : "
End If
End If
Next
'Cleany Cleany
objRec2.Close
Set objRec2 = Nothing
%>
|
<% End Sub 'DisplayLinkNavigation %>
<%
Public Sub DisplayArticleCats
CatID = Request.QueryString("CatID")
Set objRec = CreateObject("ADODB.Recordset")
Set objRec.ActiveConnection = my_Conn
objRec.LockType = 2
If Len(CatID) > 0 Then
objRec.Open("SELECT Title, CatDesc, Forum_ID FROM FORUM_Site_Cats WHERE CatID=" & CatID)%>
|
<%=objRec("Title")%> |
|
<%=objRec("CatDesc")%> |
<%
If objRec("Forum_ID") <> "" Then
'display the related Forum
%>
|
Related Forum: |
<%
strSQL = "SELECT " & strTablePrefix & "FORUM.FORUM_ID, " & strTablePrefix & "FORUM.F_DESCRIPTION, " & strTablePrefix & "FORUM.F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & objRec("FORUM_ID")
set rsForum = my_Conn.Execute (strSql)
if rsForum.eof or rsForum.bof then
Response.Write """No Forum Found!"""
Else%>
<%
End If
rsForum.Close
set rsForum = nothing
%>
|
<% End If %>
<% objRec.Close
objRec.Open("SELECT * FROM FORUM_Site_Cats WHERE ParentID=" & CatID &" ORDER BY Title ASC;")
Else
objRec.Open("SELECT * FROM FORUM_Site_Cats WHERE ParentID = 0 ORDER BY Title ASC;")
End If
Set objRec2 = Server.CreateObject ("ADODB.Recordset")
objRec2.Open "FORUM_Site_Links WHERE LinkType = 3", my_Conn, 3, 3
Set objRec3 = Server.CreateObject ("ADODB.Recordset")
objRec3.Open "FORUM_Site_Cats", my_Conn, 3, 3
If objRec.EOF AND objRec.BOF then
Response.Write " "
Else%>
<%
i = 1
DO UNTIL objRec.EOF
if not i mod 2 = 0 then %>
|
|
<%else%>
|
<%end if
i = i + 1
objRec.movenext
LOOP
%>
<%
End If
objRec.Close
Set objRec = Nothing
objRec3.Close
objRec2.Close
Set objRec2 = Nothing
Set objRec3 = Nothing
End Sub 'DisplayCats
%>
<%
Public Sub DisplayArticles
If Request.QueryString("catid") = "" then
CatID = 0
CatTitle = SiteName
Else
CatID = Request.QueryString("catid")
CatTitle = Request.QueryString("cattitle")
End If
'Create a recordset with the top level categories in it.
Set objRec2 = CreateObject("ADODB.Recordset")
Set objRec2.ActiveConnection = my_Conn
objRec2.LockType = 2
If mLev = 4 Then
SQL = "SELECT * FROM FORUM_Site_Links WHERE CatID = " & CatID & " AND LinkType = 3 ORDER BY Added DESC;"
Else
SQL = "SELECT * FROM FORUM_Site_Links WHERE CatID = " & CatID & " AND LinkType = 3 AND Validated = 1 ORDER BY Name, Hits DESC;"
End If
objRec2.Open SQL, my_Conn, 3, 3
%>
<% DO UNTIL objRec2.EOF %>
<%
If objRec2("Votes") <> "0" then
Rate = round(objRec2("Score")/objRec2("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "
"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
LinkStatus = objRec2("Badlink")
Select Case LinkStatus
Case 0
LinkStatus = "Working"
Case Else
LinkStatus = "Down!!"
End Select
%>
<%
'Move to the next record in the record set.
objRec2.MoveNext
LOOP %>
<% 'Time to clean up
objRec2.Close
Set objRec2 = Nothing
End Sub 'Displaylinks
Sub FillArray
i = 0
'Loop until the top level category is found.
DO UNTIL CatID = 0
'Create a filtered recordset with only one record.
objRec2.Filter = "CatID = " & CatID
arCatIDs(i) = objRec2("CatID")
arCatTitles(i) = objRec2("Title")
If NOT objRec2("ParentID") = 0 then
Redim Preserve arCatIDs(i+1)
Redim Preserve arCatTitles(i+1)
End If
CatID = objRec2("ParentID")
i = i + 1
LOOP
End Sub
%>