Print Page | Close Window

MOD: Latest Forum Posts in Default.asp

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=21916
Printed Date: 28 March 2026 at 2:21pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: MOD: Latest Forum Posts in Default.asp
Posted By: Praveen
Subject: MOD: Latest Forum Posts in Default.asp
Date Posted: 13 November 2006 at 6:57pm
Hi
 
I have mixed many mods for creating this simple mod of Latest forum posts which you can customise. I have just typed the code which you may insert where ever you need in the default.asp file. Please post comments and bugs here. It will surely be helpful for me.
 
<table width=100% cellspacing=1 cellpadding=1 border=0>
 <tr class="tableSubLedger">
    <td colspan="2"><%="Latest Forum Posts"%></td>
  </tr>
  <tr class="tableRow">
    <td>&nbsp;</td>
    <td><table cellspacing="1" cellpadding="3" class="tableBorder" align="center">
        <% If strDatabaseType = "Access" Then %>
        <tr class="tableSubLedger">
          <td width="38%" align="center" style="color:#FFA1C1">Topic</td>
          <td width="19%" align="center" style="color:#FFA1C1">Forum</td>
          <td width="15%" align="center" style="color:#FFA1C1">Author</td>
          <td width="21%" align="center" style="color:#FFA1C1">Date</td>
          <td width="7%" align="center" style="color:#FFA1C1">Views</td>
        </tr>
        <%
Dim intSay
Dim rsLatestPosts2
Dim sql2
Dim rsLatestPosts
Dim strTopicSubject
Dim strTopicSubjectOrj
Dim NumberOfPosts
Dim strFirstPostMsg
Dim LastLatestPostsDateTime
Dim LastLatestPostsDate
Dim LastLatestPostsTime
Set rsLatestPosts = Server.CreateObject("ADODB.Recordset")
strSql = "Select " & strDbTable & "Topic.Subject, " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Topic.Last_Thread_ID, " & strDbTable & "Topic.No_of_views "
strSql = strSql & "From " & strDbTable & "Topic, " & strDbTable & "Forum Where " & strDbTable & "Topic.Hide = False And " & strDbTable & "Topic.Forum_ID = " & strDbTable & "Forum.Forum_ID Order By " & strDbTable & "Topic.Last_Thread_ID desc"
rsLatestPosts.Open strSQL, adoCon
If rsLatestPosts.EOF Then
 Response.Write "<tr class=""tableRow""><td colspan=5>No recent posts. Please check back later.</td></tr>"
Else
For intSay = 1 to 100
if rsLatestPosts.Eof Then Exit For
Set rsLatestPosts2 = Server.CreateObject("ADODB.Recordset")
sql2 = "SELECT tblThread.Thread_ID, tblThread.Topic_ID, tblThread.Message_date, tblAuthor.Username, tblAuthor.Author_ID FROM (tblAuthor INNER JOIN tblThread ON tblAuthor.Author_ID = tblThread.Author_ID) WHERE tblThread.Hide = False And Topic_ID= " & rsLatestPosts("Topic_ID") & " order by Message_date desc"
rsLatestPosts2.Open sql2, adoCon
LastLatestPostsDateTime = rsLatestPosts2("Message_date")
LastLatestPostsDate = DateFormat(LastLatestPostsDateTime)
LastLatestPostsTime = TimeFormat(LastLatestPostsDateTime)
   intForumColourNumber = intForumColourNumber + 1
   Response.Write(vbCrLf & " <tr ")
   If (intForumColourNumber MOD 2 = 0 ) Then Response.Write("class=""evenTableRow"">") Else Response.Write("class=""oddTableRow"">")
   Response.Write("<td>")
Response.Write "<a class=""smLink"" href=""forum_posts.asp?TID=" & rsLatestPosts("Topic_ID") & "&get=last#" & rsLatestPosts("Last_Thread_ID") & """ title="""">" & rsLatestPosts("Subject") & "</a></td><td><a class=""smLink"" href=""forum_topics.asp?FID=" & rsLatestPosts("Forum_ID") & """>" & rsLatestPosts("Forum_name") & "</a></td><td align=""center""><span class=""smText"">"&rsLatestPosts2("Username") &"</span></td><td align=""center""><span class=""smText"">" & LastLatestPostsDate & "-" & LastLatestPostsTime & "</span></td><td align=""center""><span class=""smText"">" & rsLatestPosts("No_of_views") & "</span></td></tr>"
rsLatestPosts.MoveNext
Next
end if
end if
'Clean up
Call closeDatabase()
%>
      </table></td>
  </tr>
</table>
 
Thank You
Regards
Praveen Kumar


-------------



Replies:
Posted By: justme
Date Posted: 14 November 2006 at 3:17am

Using MS Access, I get the following:

 
ADODB.Recordset error '800a0e7d'

The connection cannot be used to perform this operation. It is either closed or invalid in this context.

/forum/default.asp, line 894

 
line 894 is: rsLatestPosts.Open strSQL, adoCon
 


Posted By: Praveen
Date Posted: 14 November 2006 at 11:54am
You have to find this:
Call closeDataBase()
and comment it like this
'Call closeDataBase()
 
Reply What happened
 
Regards
Praveen


-------------


Posted By: coolguy
Date Posted: 15 November 2006 at 5:27am
Works great, thank you.


Posted By: Praveen
Date Posted: 15 November 2006 at 12:43pm
Welcome. Be sure to look at this topic for more info..

-------------


Posted By: javi712
Date Posted: 15 November 2006 at 3:55pm
Hi Praveen,

Any chance of you creating something similar for a page sitting outside of the forum?

There have been a couple thrown around in other MODs, but none functioning correctly last time I checked.

Thanks!


Posted By: Praveen
Date Posted: 15 November 2006 at 4:28pm
Ya why not?? Let me do it. But you have to wait for a while. Any problem with this mod??

-------------


Posted By: javi712
Date Posted: 15 November 2006 at 4:56pm
Thank you so much Praveen, I do not mind waiting at all!

As for this mod, no problems at all!

Thanks so much again!


Posted By: Praveen
Date Posted: 15 November 2006 at 5:00pm

Ya Marquee style can be done using the javascripts. But what exactly are you trying to say about the marquee style. Can you explain??



-------------


Posted By: coolguy
Date Posted: 15 November 2006 at 5:29pm
Praveen, it would be cool to create something like this latest posts but in a Marquee style. Do you think it can be done?


Posted By: Praveen
Date Posted: 15 November 2006 at 5:34pm
Originally posted by coolguy coolguy wrote:

Praveen, it would be cool to create something like this latest posts but in a Marquee style. Do you think it can be done?

Ya Marquee style can be done using the javascripts. But what exactly are you trying to say about the marquee style. Can you explain??



-------------


Posted By: coolguy
Date Posted: 15 November 2006 at 5:40pm
I will give you an example. Checkout this form, it has a marquee going across on top of the page with the latest 10 posts. How is that done?
 
http://www.sharkawyonline.com/forum2/ - http://www.sharkawyonline.com/forum2/


Posted By: Praveen
Date Posted: 15 November 2006 at 5:42pm
Is it possible for you to get the source code of that default.asp??

-------------


Posted By: coolguy
Date Posted: 15 November 2006 at 5:46pm
I asked him but no reply Big%20smile


Posted By: coolguy
Date Posted: 15 November 2006 at 5:46pm
I think he does it by linking the RSS feed with a marquee, I just don't know how to do it.


Posted By: Praveen
Date Posted: 15 November 2006 at 5:57pm
OK. Let me try.

-------------


Posted By: ozankantar
Date Posted: 29 November 2006 at 9:15pm
this mod with access :S
 
ms-sql?


Posted By: yourbudweiser
Date Posted: 01 December 2006 at 3:11pm
This works nice for me but I have a twist.

I want to display all the posts for each topic under each of the topics.

I am currently working on this but would like to get your input as well.

Thanks!


Posted By: coolguy
Date Posted: 01 December 2006 at 7:16pm

I figured out how he is doing it. He is using an IFRAME ticker to rap around the last 10 posts ASP script. I will try to code it myself. Let me know if you want me to share my test results.

 
 
 
Originally posted by coolguy coolguy wrote:

I will give you an example. Checkout this form, it has a marquee going across on top of the page with the latest 10 posts. How is that done?
 
http://www.sharkawyonline.com/forum2/ - http://www.sharkawyonline.com/forum2/
 
 


Posted By: Praveen
Date Posted: 02 December 2006 at 11:29am
OK OK

-------------


Posted By: coolguy
Date Posted: 02 December 2006 at 5:21pm

The following is a simple Marquee script from dynamic drive that uses an external file for its data, in this case, the external file is the last 10 posts.ASP file. The Marquee direction is vertical, I am still working on a Marquee that goes horizontally. I tested this script and it works nicely.

 
 
 

<!--[if IE]>

<IE:Download ID="marqueedata" STYLE="behavior:url(#default#download)" />

<marquee id="externalmarquee" direction=up scrollAmount=2 style="width:400px;height:250px;border:0px solid black;padding:3px" onMouseover="this.scrollAmount=0" onMouseout="this.scrollAmount=2" src="last10posts.asp"></marquee>

 

<script language="JavaScript1.2">

/*

External Data Source Marquee Script (Updated 99/11/02)-

© Dynamic Drive (www.dynamicdrive.com)

For full source code, installation instructions,

100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com

*/

function downloaddata(){

marqueedata.startDownload(externalmarquee.src,displaydata)

}

function displaydata(data){

externalmarquee.innerHTML=data

}

if (document.all)

window.onload=downloaddata

 

</script>

<![endif]-->



Posted By: ryu701
Date Posted: 06 December 2006 at 8:20pm
Praveen, this is what me and my forum users have been waiting for for a long time. Thank you very much!


Posted By: ToJaRo
Date Posted: 09 December 2006 at 5:46pm
I get this error.
 
Microsoft VBScript runtime error '800a01a8'

Object required: 'adoCon'

/database/database_connection.asp, line 287

 
I run MS SQL version. Ideas?


-------------
ToJaRo
http://www.thesoupbone.com - The SoupBone Community


Posted By: Praveen
Date Posted: 16 December 2006 at 5:40pm
Ya Welcome...

-------------


Posted By: rvhattum
Date Posted: 28 December 2006 at 6:15pm
Originally posted by ToJaRo ToJaRo wrote:

I get this error.
 
Microsoft VBScript runtime error '800a01a8'

Object required: 'adoCon'

/database/database_connection.asp, line 287

 
I run MS SQL version. Ideas?
 
I have exactly the some problem. Does anybody knows the solution?
 
Thanks.
 
Ps. I'm also running an MySQL database


Posted By: Praveen
Date Posted: 28 December 2006 at 6:55pm
Just check for the Dimensioning of adoCon or you define it again... Ask -boRg- for more help...
 
Friends.. Iam under a severe exam tension.. So please excuse me for a month... Thanks..
 
Praveen..


-------------


Posted By: Gando
Date Posted: 05 January 2007 at 4:49pm
I only want to latest any topic forum posts. Like not all webwiz, only forum_topics.asp?FID=18 - Web Wiz Forums Version 8.x Support or only forum_topics.asp?FID=19 - Web Wiz Forums 8.x Modifications sub forum_topics.asp?FID=19 - forum topic. How can I do that? Anyone have an idea?


Posted By: Praveen
Date Posted: 05 January 2007 at 4:50pm
Ya theres available.. I too have that

-------------


Posted By: Praveen
Date Posted: 07 January 2007 at 12:06pm
But now only I saw that its only for Latest Forum Topics

-------------


Posted By: PrivateEye
Date Posted: 29 January 2007 at 9:41am
What if I am using SQL Server version. Praveen Will you be kind enough to write the SQL statement for SQL version please.

-------------
The Judgement Day


Posted By: MrMellie
Date Posted: 29 January 2007 at 10:16pm
There's an SQL version in another thread.


Posted By: Gando
Date Posted: 30 January 2007 at 12:34am
Nobody understood me I think? Confused

How can I customise my latest forum or sub forum posts? Because I only want to see posts from specific forums. Not all mixed forum posts.
 
I want to look at all posts from a specific forum or sub forum. Not all post from all forums.
 
Subject, Topic Starter, Date and maybe View and Replies.


Posted By: Pfeff
Date Posted: 30 January 2007 at 1:16am
There is one available for SQL Server, I haven't run across it that runs on mySQL.

http://forums.webwiz.net/forum_posts.asp?TID=19472&KW=latest+posts&PID=117937#117937 - http://forums.webwiz.net/forum_posts.asp?TID=19472&KW=latest+posts&PID=117937#117937

BOttom of page three refers to how to get it done with SQL Server.

If anyone has one for this mod, I'd be greatly appreciated!

Dan


Posted By: MrMellie
Date Posted: 30 January 2007 at 10:53am
The "MSSQL Last 10 Posts" thread includes a version that runs on all 3 databases - Access, mySQL and MS-SQL. The query can be easily changed to select specific forums and the fields that you display in the preview table.


Posted By: Pfeff
Date Posted: 01 February 2007 at 2:42am
Got it for certain forums.

<%

Dim LastLatestPostsDateTime
Dim LastLatestPostsDate
Dim LastLatestPostsTime
Dim intStyle
Dim strShtMess
Dim saryTop10
Dim intRows
Dim fld_Subject
Dim fld_Topic_ID
Dim fld_Views
Dim fld_Date
Dim fld_Author
Dim fld_Thread_Id
Dim fld_Message

'### Set intStyle to give the required output
'### 1 = Top 10 latest posts, regardless of which Topic they appear in (gives a true Top 10 posts, but some might share the same Topic)
'### 2 = Top l0 latest Topics that have been posted to (gives unique Topics).
intStyle=1

strSql = "SELECT "
if strDatabaseType <> "mySQL" then strSql = strSql & "TOP 10 "
strSql = strSql & "T.Subject, T.Topic_ID, T.No_of_views, Th.Message_date, Au.Username, Th.Thread_ID, Th.message " & _
        "FROM " & strDbTable & "Topic T" & strDBNoLock & " " & _
        "INNER JOIN (" & strDbTable & "Thread Th" & strDBNoLock & " INNER JOIN " & strDbTable & "Author Au" & strDBNoLock & " " & _
        "ON Th.Author_ID = Au.Author_ID) "
if intStyle=1 then      
    strSql = strSql & "ON T.Topic_ID = Th.Topic_ID "
else
    strSql = strSql & "ON T.Last_Thread_ID = Th.Thread_ID "
end if
'### In the next line 25 represents the forum number      
strSql = strSql & "WHERE T.Hide = 0 and T.Forum_ID = 25 " & _

        "ORDER By Th.Message_date DESC "
if strDatabaseType = "mySQL" then strSql = strSql & "LIMIT 10"

rsCommon.Open strSQL, adoCon
saryTop10 = rsCommon.GetRows()

'Clean up
Call closeDatabase()

intRows = UBound(saryTop10, 2)

fld_Subject = 0
fld_Topic_ID = 1
fld_Views = 2
fld_Date = 3
fld_Author = 4
fld_Thread_Id = 5
fld_Message = 6


Response.Write "<table cellspacing=""1"" cellpadding=""3"" class=""tableBorder"" align=""center"">" & vbNewline & _
"<tr class=""tableLedger"">" & vbNewline & _
" <td colspan=""5"">Most Recent Topics - <a href='http://forums.sportsrubes.com'>Go to Forums Now!</a></td>" & vbNewline & _
" </tr>" & vbNewline & _
"      <tr class=""tableSubLedger"">" & vbNewline & _
"        <td width=""25%"" align=""center"">Topic</td>" & vbNewline & _
"        <td width=""33%"" align=""center"">Message</td>" & vbNewline & _
"        <td width=""15%"" align=""center"">Author</td>" & vbNewline & _
"        <td width=""20%"" align=""center"">Date</td>" & vbNewline & _
"        <td width=""7%"" align=""center"">Views</td></tr>" & vbNewline

If intRows=0 Then
    Response.Write "<tr class=""tableRow""><td colspan=5>No recent posts. Please check back later.</td></tr>" & vbNewline
Else
   for i = 0 to intRows
        LastLatestPostsDateTime = cDate(saryTop10(fld_Date,i))
        LastLatestPostsDate = DateFormat(LastLatestPostsDateTime)
        LastLatestPostsTime = TimeFormat(LastLatestPostsDateTime)
        strShtMess = left(saryTop10(fld_Message,i),40) & "..."
        Response.Write vbCrLf & " <tr "
        If (i MOD 2 = 0 ) Then Response.Write("class=""evenTableRow"">") Else Response.Write("class=""oddTableRow"">")   
        Response.Write("<td>")
        Response.Write "<a class=""smLink"" href=""" & strForumPath & "/forum_posts.asp?TID=" & CLng(saryTop10(fld_Topic_ID,i)) & "&get=last#" & saryTop10(fld_Thread_ID,i) & """ title="""">" & saryTop10(fld_Subject,i) & "</a></td>" & _
        "<td><span class=""smText"">" & strShtMess & "</span></td>" & _
        "<td align=""center""><span class=""smText"">" & saryTop10(fld_Author,i) &"</span></td>" & _
        "<td align=""center""><span class=""smText"">" & LastLatestPostsDate & "-" & LastLatestPostsTime & "</span></td>" & _
        "<td align=""center""><span class=""smText"">" & saryTop10(fld_Views,i) & "</span></td></tr>"
    next
end if

Response.Write "</table>"
%>

Thanks Brian for figuring this out!


Posted By: MrMellie
Date Posted: 02 February 2007 at 10:07am
Pfeff, you don't need to include the Forum_ID field in the selected fields just because it's now in the WHERE clause.

strSql = strSql & "T.Subject, T.Topic_ID, T.Forum_ID, T.No_of_views, Th.Message_date, Au.Username, Th.Thread_ID, Th.message " & _

can stay as:

strSql = strSql & "T.Subject, T.Topic_ID, T.No_of_views, Th.Message_date, Au.Username, Th.Thread_ID, Th.message " & _




Posted By: Pfeff
Date Posted: 03 February 2007 at 12:28am
Too sweet! I love learning. Thanks again!


Posted By: Pfeff
Date Posted: 03 February 2007 at 12:30am
Is it possible to include posts from category ID?

I have a forum about sports. I have a category on hunting. I have 8 hunting subforums.

On the hunting index page I want to include the top 10 posts from the hunting category.


Posted By: MrMellie
Date Posted: 03 February 2007 at 2:35pm
Don't see why it can't be done. I've just been doing a big cleanup of the code (which I'll put in a new thread as it's changed a fair bit) so I'll take a look at categories as well.


Posted By: Pfeff
Date Posted: 03 February 2007 at 2:39pm
Thanks bud!


Posted By: Gando
Date Posted: 01 March 2007 at 12:37am
Somebody help me please? I am using Access database.

Originally posted by Gando Gando wrote:

I only want to latest any topic forum posts. Like not all webwiz, only forum_topics.asp?FID=18 - Web Wiz Forums Version 8.x Support or only forum_topics.asp?FID=19 - Web Wiz Forums 8.x Modifications sub forum_topics.asp?FID=19 - forum topic. How can I do that? Anyone have an idea?



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