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)
 Find last Post, Topic or Reply
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

troels
Starting Member

Denmark
11 Posts

Posted - 11 January 2003 :  19:55:42  Show Profile
I have a default startpage on my website (not the forum).

On this page I would like to show the last
Topic or Reply in this form
If the last post = Topic then link to Topic
if the last post = Reply then link to Reply

I know how to set it up - what I dont know is to find the last,
I am able to in table : FORUM_FORUM to find the
last Topic
last Reply
but how do I figure out if the last is either the Topic or the Reply or is this not possible,
I have search the database for a hint - but canīt find it - and the code in default.asp which show the [with the last post on .... ] under Statistics I have not been able to figure out

any help any1

thansk in advance
Troels Majlandt
http://dot.dyndns.dk/forum/default.asp

Edited by - ruirib on 12 January 2003 18:51:47

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 11 January 2003 :  23:31:55  Show Profile
quote:
Originally posted by troels
I know how to set it up - what I dont know is to find the last,
I am able to in table : FORUM_FORUM to find the
last Topic
last Reply
but how do I figure out if the last is either the Topic or the Reply or is this not possible,

i think, for a new topic, the F_LAST_REPLY_ID will be 0
so we can determine the last post is Topic or Reply by this F_LAST_REPLY_ID value = 0 or not.

for example, the DoLastPostLink function in default.asp page...
you can find the code something like this...
Function DoLastPostLink(showicon)
	if ForumLastPostReplyID <> 0 then
		:
		:
	elseif ForumLastPostTopicID <> 0 then
		:
		:
	else
		:
	end if
end function
Go to Top of Page

troels
Starting Member

Denmark
11 Posts

Posted - 12 January 2003 :  05:15:24  Show Profile
Yes thatīs correct the if a Forum last post is a Topic then F_Last_Reply will be 0 but, it is not enough, but you got me on the right track i think.

I need to look at the F_LAST_POST in the FORUM_FORUM table, here I need to find the higest value (latest post)
then if F_LAST_REPLY is 0 then last post is a Topic else it is a Reply.

tx
Troels
Go to Top of Page

troels
Starting Member

Denmark
11 Posts

Posted - 12 January 2003 :  13:11:39  Show Profile
Yes so now I have this (post it so other might use it)
Maybe not the best of code - but it works.

- - - - - - - - - - - - - - - - - - - - - - -
' Find latest FORUM and TOPIC and REPLY
SQLstmt7 = "select top 1 F_LAST_POST_REPLY_ID,F_SUBJECT from FORUM_FORUM order by F_LAST_POST desc"
Set rs7 = conn3.Execute(SQLstmt7)

IF rs7("F_LAST_POST_REPLY_ID") = 0 then ' F_LAST_POST_REPLY_ID = 0 then it is a Topic
Forum = rs7("F_SUBJECT")
SQLstmt6 = "select T_SUBJECT from FORUM_TOPICS where TOPIC_ID = " & rs7("F_LAST_POST_TOPIC_ID")
Set rs6 = conn3.Execute(SQLstmt6)
Topic = rs6("T_SUBJECT")
url = "Topic_ID=" & rs7("F_LAST_POST_TOPIC_ID")
ELSE ' F_LAST_POST_REPLY_ID <> 0 then it is a Reply
Forum = rs7("F_SUBJECT")
SQLstmt6 = "select T_SUBJECT from FORUM_TOPICS where TOPIC_ID = " & rs7("F_LAST_POST_TOPIC_ID")
Set rs6 = conn3.Execute(SQLstmt6)
Topic = rs6("T_SUBJECT")
url = "Topic_ID=" & rs7("F_LAST_POST_TOPIC_ID") & "&Reply_ID=" & rs7("F_LAST_POST_REPLY_ID")
END IF
- - - - - - - - - - - - - - - - - - - - - - -
Then I can make the link to latest topic/reply
Latest topic/reply in forum <a href="../Forum/topic.asp?<%=url%>">[Forum] : <%=forum%> [Topic] : <%=Topic%></a>

hope some1 can use it

Troels M
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 13 January 2003 :  04:19:59  Show Profile  Visit MarcelG's Homepage
Troels,

how did you use this ? Have you included more than config.asp in the ASP file you included the code in ? This, because I am interested in using this code also.

portfolio - linkshrinker - oxle - twitter
Go to Top of Page

troels
Starting Member

Denmark
11 Posts

Posted - 13 January 2003 :  19:01:57  Show Profile
Hi marcelgoertz !

I use it on another page, so i had to make the recordset,
Set Conn3 = Server.CreateObject("ADODB.Connection")
Conn3.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.MapPath("../fpdb/lsforum.mdb")

I do know that you would be able to make the "data" by include some of the forum files, but it was a bit more easy (and quicker) to make the recordset myself.

If you need more info then send ask here or send me a email troels@majlandt.dk
Troels Majlandt
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.26 seconds. Powered By: Snitz Forums 2000 Version 3.4.07