Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Forum Array code for forum.asp
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

StephenD
Senior Member

Australia
1044 Posts

Posted - 12 May 2005 :  21:46:44  Show Profile  Send StephenD a Yahoo! Message
I need help with some code in forum.asp

I've got an array in inc_header that looks like this:
intAllowedCategoryArray = Array(2,3,5,10,11,12,13)

I want to show a new post button on forum.asp and topic.asp beside the 'New Topic' buttons.

I've got a code check that works on post.asp:


For x = 0 to UBound(intAllowedCategoryArray)
    If strRqForumID = intAllowedCategoryArray(x) Then
        blnForumCheck = 1
        x = UBound(intAllowedCategoryArray)
    End If
Next

If blnForumCheck = 1 Then


I need this modified to work on forum.asp and topic.asp where the strRqForumID variable is different .. or not called that at all. Anyone got any ideas?

Do I need to declare something related to the Forum_ID at the top of each page?

Edited by - StephenD on 12 May 2005 21:47:29

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 13 May 2005 :  05:26:49  Show Profile
In forum.asp, line 44:
if (Request("FORUM_ID") = "" or IsNumeric(Request("FORUM_ID")) = False) and (Request.Form("Method_Type") <> "login") and (Request.Form("Method_Type") <> "logout") then
	Response.Redirect "default.asp"
else
	Forum_ID = cLng(Request("FORUM_ID"))
end if
In topic.asp, line 146:
Forum_Status = rsTopic("F_STATUS")
Forum_ID = rsTopic("FORUM_ID")
Forum_Subject = rsTopic("F_SUBJECT")
Forum_Subscription = rsTopic("F_SUBSCRIPTION")
Forum_Moderation = rsTopic("F_MODERATION")
On another note, rather than looping through an array until you find a match, make inAllowedCategoryArray a string and us an if statement to see if Forum_ID is in that string as follows:

if instr(","&intAllowedCategoryArray&",",","&Forum_ID&",")>0 then ...


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

StephenD
Senior Member

Australia
1044 Posts

Posted - 13 May 2005 :  22:50:26  Show Profile  Send StephenD a Yahoo! Message
Thanks Shaggy

It works for Forum.asp but I get a type mismatch error in topic.asp

For x = 0 to UBound(intAllowedCategoryArray)
    If rsTopic("FORUM_ID") = intAllowedCategoryArray(x) Then
        blnForumCheck = 1
        x = UBound(intAllowedCategoryArray)
   End If
Next

If blnForumCheck = 1 then Response.Write ...etc..


I tried replacing that block of code with
if instr(","&intAllowedCategoryArray&",",","&Forum_ID&",")>0 then
but I got a typemismatch error on that line too.
Go to Top of Page

StephenD
Senior Member

Australia
1044 Posts

Posted - 14 May 2005 :  22:39:05  Show Profile  Send StephenD a Yahoo! Message
Got it. Moved this block:
For x = 0 to UBound(intAllowedCategoryArray)
    If rsTopic("FORUM_ID") = intAllowedCategoryArray(x) Then
        blnForumCheck = 1
        x = UBound(intAllowedCategoryArray)
   End If
Next

up before
rsTopic.close
set rsTopic = nothing
line 169
Shaggy, if you get a chance I'd like to explore using your suggestion of a string instead of the way I'm doing it if it is faster and uses less resources. Thanks for all your help (again!).
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 16 May 2005 :  05:38:43  Show Profile
If you needed to, you could place it back where it was and use Forum_ID instead of rsTopic("FORUM_ID").

Unless you have a huge array of forums you're checking for, you're not going to notice any significant improvement in execution time or resource usage using instr. Still, no harm in keeping your options open. The reason you got a type mismatch error when you tried using it was because intAllowedCategoryArray is an array - to use instr, you'll have to make it a string instead.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07