Print Page | Close Window

Showing latest Topics on another page???

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=661
Printed Date: 29 March 2026 at 3:06pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Showing latest Topics on another page???
Posted By: klr3
Subject: Showing latest Topics on another page???
Date Posted: 02 March 2003 at 3:22pm
HELP!!!!!!

I have a problem in useing the following script, that displays the latest topics on any page on my website - regarding the 7.0 Beta 3 version

The problem is, that I only want it to display newest topics, but as it is now, it jumpes for topics to topic, every time some one replies to the topic!!! Even though the topic i months old!!!!

Want do I need to chance in the script, to make it ONLY display the new topics???

Please help!!!


The script:
<%
Dim rsLastestPosts
Dim strPosts
Dim adoCon
Dim strCon
Dim strSQL

'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath("../forum/admin/database/XXX.mdb")

'Set an active connection to the Connection object
adoCon.Open strCon

Set rsLastestPosts = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT Top 15 tblTopic.*, tblForum.* "
strSQL = strSQL & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID "
strSQL = strSQL & "WHERE ((tblForum.Password) Is Null) "
strSQL = strSQL & "ORDER BY tblTopic.Last_entry_date DESC;"

rsLastestPosts.Open strSQL, strCon

If rsLastestPosts.EOF Then Response.Write "Ingen nye indlęg"

Do while NOT rsLastestPosts.EOF

If len(rsLastestPosts("Subject"))>14 then
     strPosts = left(rsLastestPosts("Subject"),14) & "... "
Else
     strPosts = rsLastestPosts("Subject")
End If


%>
<a href="forum_posts.asp?TID=<% = rsLastestPosts("Topic_ID") %>" target="_self"><% = strPosts %></a>

<%     
rsLastestPosts.MoveNext
Loop
rsLastestPosts.Close
Set rsLastestPosts = Nothing
adoCon.Close
Set adoCon = Nothing
Set strCon = Nothing
%>


Thank you for helping! :O)



Replies:
Posted By: klr3
Date Posted: 03 March 2003 at 3:50am

Yeaarrhhhh!

I have solved the problem, just ad following (marked with green) to the the SQL string:

strSQL = strSQL & "WHERE ((tblForum.Password) Is Null) and Start_date = Last_entry_date "

Full code for displaying latest topic on any page - NOT depending on replies:

<%
Dim rsLastestPosts
Dim strPosts
Dim adoCon
Dim strCon
Dim strSQL

'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath("../forum/admin/database/XXX.mdb")

'Set an active connection to the Connection object
adoCon.Open strCon

Set rsLastestPosts = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT Top 15 tblTopic.*, tblForum.* "
strSQL = strSQL & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID " 
strSQL = strSQL & "WHERE ((tblForum.Password) Is Null) and Start_date = Last_entry_date "
strSQL = strSQL & "ORDER BY tblTopic.Last_entry_date DESC;"

rsLastestPosts.Open strSQL, strCon

If rsLastestPosts.EOF Then Response.Write "Ingen nye indlęg"

Do while NOT rsLastestPosts.EOF

If len(rsLastestPosts("Subject"))>14 then
     strPosts = left(rsLastestPosts("Subject"),14) & "... "
Else
     strPosts = rsLastestPosts("Subject")
End If


%>
<a href="forum_posts.asp?TID=<% = rsLastestPosts("Topic_ID") %>" target="_self"><% = strPosts %></a>

<%     
rsLastestPosts.MoveNext
Loop
rsLastestPosts.Close
Set rsLastestPosts = Nothing
adoCon.Close
Set adoCon = Nothing
Set strCon = Nothing
%>

Hope someone else can use it! :O)



Posted By: Scotty32
Date Posted: 03 March 2003 at 4:48am
 mind if i use that? id like to show this on another page but dunno how to

-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: klr3
Date Posted: 03 March 2003 at 6:40am

Go ahead!

You can change the numbers of topics, shown on the page by editing the following code: strSQL = "SELECT -->Top 15 <-- tblTopic.*, tblForum.* "




Posted By: Scotty32
Date Posted: 03 March 2003 at 8:04am

kool, thanks,

so does the bottom one show the list of lastest topics, not posts?

and the top one is lastest posts? or does the top one not work at all?



-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net