Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Showing latest Topics on another page???
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Showing latest Topics on another page???

 Post Reply Post Reply
Author
klr3 View Drop Down
Groupie
Groupie
Avatar

Joined: 20 February 2003
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote klr3 Quote  Post ReplyReply Direct Link To This Post Topic: Showing latest Topics on another page???
    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)


Edited by klr3
Back to Top
klr3 View Drop Down
Groupie
Groupie
Avatar

Joined: 20 February 2003
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote klr3 Quote  Post ReplyReply Direct Link To This Post 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)

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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 - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
klr3 View Drop Down
Groupie
Groupie
Avatar

Joined: 20 February 2003
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote klr3 Quote  Post ReplyReply Direct Link To This Post 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.* "




Edited by klr3
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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 - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.