Author |
Topic |
StephenD
Senior Member
Australia
1044 Posts |
Posted - 17 February 2004 : 11:23:13
|
I've been working on a couple of custom pages that display on one page a simple list of topics from selected forums.
For the forum selection I'd like to use an array that I have declared in inc_header.asp:intAllowedCategoryArray = Array(50,51,52,53,54,55,56,57,58)
This is what it looks like at the moment: http://www.stephendoyle.net/hl_equipment2.asp U:snitz, P: snitz ... which is not very good. It seems to only display one page of topics.
Here is a text version of my file. http://www.stephendoyle.net/hl_equipment2.txt
Once again, all help will be sincerely appreciated. |
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 17 February 2004 : 14:49:40
|
I get errors on the ASP page, and I don't think that matches the TXT file. |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 17 February 2004 : 18:07:13
|
Laser, I can't understand why you can't see the page. Anyone else unable to view? |
|
|
ajhvdb
Junior Member
Netherlands
392 Posts |
Posted - 17 February 2004 : 18:51:33
|
After login i get asp error: Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near ')'.
/hl_equipment2.asp, line 112
|
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 17 February 2004 : 18:58:48
|
Oops, seems the error occurs for standard user only. I'm at work now and can't fix it till I get home later. Sorry guys.
I've put a screenshot in my FilesLibrary> Images folder. |
Edited by - StephenD on 17 February 2004 19:11:38 |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 19 February 2004 : 20:42:17
|
I'm in trouble here. I can't understand why an Admin can view the page without an error and a normal user will get the followingMicrosoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near ')'.
/hl_equipment2.asp, line 112 This is my code up to that point (Note -I've only editied out the copyright info for the purpose of this post):
Snitz copyright info here
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_moderation.asp" -->
<%
'## Forum_SQL
strSql = "SELECT F.FORUM_ID, " & _
"F.F_SUBJECT, " & _
"F.F_STATUS, " & _
"C.CAT_ID, " & _
"C.CAT_NAME, " & _
"C.CAT_STATUS, " & _
"T.T_STATUS, " & _
"T.TOPIC_ID, " & _
"T.T_MSGICON, " &_
"T.T_SUBJECT, " & _
"T.T_AUTHOR, " & _
"M.M_NAME, " & _
"T.T_LAST_POST_AUTHOR, " & _
"T.T_LAST_POST, " & _
"T.T_LAST_POST_REPLY_ID, " & _
"MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME, " & _
"F.F_PRIVATEFORUMS, " & _
"F.F_PASSWORD_NEW, " & _
"T.T_MESSAGE " & _
"FROM " & strMemberTablePrefix & "MEMBERS M, " & _
strTablePrefix & "FORUM F, " & _
strTablePrefix & "TOPICS T, " & _
strTablePrefix & "CATEGORY C, " & _
strMemberTablePrefix & "MEMBERS MEMBERS_1 " & _
"WHERE T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID "
'###################################################################
if strPrivateForums = "1" and mLev < 4 then
strSql = strSql & " AND F.FORUM_ID IN (" & allAllowedForums & ") "
end if
strSql = strSql & "AND F.F_TYPE = 0 " & _
"AND F.FORUM_ID = T.FORUM_ID " & _
"AND C.CAT_ID = T.CAT_ID " & _
"AND M.MEMBER_ID = T.T_AUTHOR " & _
"AND (T.T_LAST_POST > '" & lastDate & "'"
' DEM --> if not an admin, all unapproved posts should not be viewed.
if mlev <> 4 then
strSql = strSql & " AND ((T.T_AUTHOR <> " & MemberID &_
" AND T.T_STATUS < 2)" ' Ignore unapproved/held posts
if mlev = 3 and ModOfForums <> "" then
strSql = strSql & " OR T.FORUM_ID IN (" & ModOfForums & ") "
end if
strSql = strSql & " OR T.T_AUTHOR = " & MemberID & ")"
end if
if Group > 1 and strGroupCategories = "1" then
strSql = strSql & " AND (C.CAT_ID = 0"
if recGroupCatCount <> "" then
for iGroupCat = 0 to recGroupCatCount
strSql = strSql & " or C.CAT_ID = " & allGroupCatData(1, iGroupCat)
next
strSql = strSql & ")"
else
strSql = strSql & ")"
end if
end if
strSql = strSql & ") "
strSql = strSql & " ORDER BY C.CAT_ORDER, C.CAT_NAME, F.F_ORDER, F.F_SUBJECT, T.T_LAST_POST DESC "
set rs = Server.CreateObject("ADODB.Recordset")
rs.cachesize = strPageSize
rs.open strSql & strSql2 & strSql3 & strSql4, my_Conn, adOpenStatic
if not rs.EOF then
rs.movefirst
rs.pagesize = strPageSize
inttotaltopics = cLng(rs.recordcount)
'rs.absolutepage = mypage '**
maxpages = cLng(rs.pagecount)
arrTopicData = rs.GetRows(strPageSize)
iTopicCount = UBound(arrTopicData, 2)
else
iTopicCount = ""
inttotaltopics = 0
end if
rs.Close
set rs = nothing After this the table gets built. If you read my original post I'm aiming only to display multiple forum topics from a selected array in inc_header. I'm not sure my entire sql statements are correct as I've modified them from default.asp and pop_topics_url.asp (insert topic hyperlink mod).
Can anyone see where I've gone wrong?
|
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 19 February 2004 : 20:46:48
|
BTW those forums are unmoderated so I don't really need any code that checks for that. Just a simple mLev < 1 redirect to login.asp will do. |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 21 February 2004 : 00:07:03
|
OK so if I change this linearrTopicData = rs.GetRows(strPageSize) toarrTopicData = rs.GetRows(adGetRowsRest) the page will display every forum topic .. which is halfway to where I need to be. I just need to filter out topics that don't belong to my Forum_ID array:intAllowedCategoryArray = Array(50,51,52,53,54,55,56,57,58)
Does anyone know how to do this? Laser gave me some code earlier in another post of mine:For x = 0 to UBound(intAllowedCategoryArray)
If strRqForumID = intAllowedCategoryArray(x) Then
blnForumCheck = 1
x = UBound(intAllowedCategoryArray)
End If
Next
If blnForumCheck = 1 then that I have tried inserting all over the place with no results.
|
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 22 February 2004 : 00:06:24
|
Am I going about this the wrong way? Would it be easier to add a new field in the Forums Table:
[ALTER]
FORUM
ADD#F_CUSTOMVIEW#int#NULL#0
[END]
[INSERT]
CONFIG_NEW
(C_VARIABLE,C_VALUE)#('strCUSTOMVIEW','0')
[END]
Then find a way to set this to '1' for each forum. And then use : If StrCustomView = 1 |
Edited by - StephenD on 22 February 2004 00:09:12 |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 24 February 2004 : 09:15:51
|
Guys? Anything? |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 26 February 2004 : 02:04:19
|
I've still got no further this week with this code. I've tried various combinations of topic.asp code but its beyond me. I'm back to my first (best) effort with the same code posted above or at:www.stephendoyle.net/hl_equipment2.txt Any ideas? |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 29 February 2004 : 21:11:08
|
Anybody got some spare time today to help with this please. I'm here for another 5 hrs. |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 29 February 2004 : 21:49:22
|
Thanks OneWayMule, I want this page to filter out every forum except the ones who's FORUM_ID appears in my Array(50,51,52,53,54,55,56,57,58).
I've put some custom msgicons that refer to equipment status - on loan, available, for repair that I want this page to display - which it does. Once I can get the filtering right I can work on some date functions like - 'days since'. |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 29 February 2004 : 22:05:27
|
Don't tell me it was that easy! DUH! So I add this line "WHERE FORUM_ID>=50 AND FORUM_ID<=58 " in my sql statement above before the '################# starts? |
|
|
Topic |
|