Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - latest 10 topics on main page
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

latest 10 topics on main page

 Post Reply Post Reply Page  123 6>
Author
unitrakya View Drop Down
Newbie
Newbie
Avatar

Joined: 06 June 2006
Location: Turkey
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote unitrakya Quote  Post ReplyReply Direct Link To This Post Topic: latest 10 topics on main page
    Posted: 23 September 2007 at 9:11am
how can i integrate the latest 10 topics to default.asp? i tried that but it give error;
 
<% If strDatabaseType = "Access" Then %>
<tr class="tableLedger">
  <td colspan="5" width="668">En son yazılan 10 konu</td>
 </tr>
 <tr class="tableSubLedger">
    <td width="225" align="center">Konu</td>
    <td width="127" align="center">Bölüm</td>
    <td width="98" align="center">Gönderen</td>
    <td width="130" align="center">Zaman</td>
    <td width="60" align="center">Okunma</td>
  </tr>
  <tr class="tableSubLedger">
    <td width="640" align="center" colspan="5"><p align="center"></P></td>
  </tr>
<%
Dim rsLatestPosts
Dim intSay
Dim rsLatestPosts2
Dim sql2
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

For intSay = 1 to 10
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)

If intGroupID <> 2 Then Response.Write "<tr class=""tableRow""><td><a href=""forum_posts.asp?TID=" & rsLatestPosts("Topic_ID") & """><img border=""0"" src=""" & strImagePath & "right_arrow.gif"" /></a>&nbsp;<a href=""forum_posts.asp?TID=" & rsLatestPosts("Topic_ID") & "&get=last#" & rsLatestPosts("Last_Thread_ID") & """>" & rsLatestPosts("Subject") & "</a></td><td><a href=""forum_topics.asp?FID=" & rsLatestPosts("Forum_ID") & """>" & rsLatestPosts("Forum_name") & "</a></td><td align=""center"">"&rsLatestPosts2("Username") &"</td><td align=""center"">" & LastLatestPostsDate & "-" & LastLatestPostsTime & "</td><td align=""center"">" & rsLatestPosts("No_of_views") & "</td></tr>"
rsLatestPosts.MoveNext
Next
end if
Call closeDatabase()
%>
Back to Top
unitrakya View Drop Down
Newbie
Newbie
Avatar

Joined: 06 June 2006
Location: Turkey
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote unitrakya Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2007 at 12:46pm
Originally posted by nobita nobita wrote:

No Thanks

 

 
what? LOL
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2007 at 2:27pm
There is a last 10 posts file in the extras folder.

You need to simply update this file in notepad to look at your own forum, then use the code in any website or page you like.

It uses the RSS Feed to get the posts, so doesn't even have to be used on the same web site.
Back to Top
unitrakya View Drop Down
Newbie
Newbie
Avatar

Joined: 06 June 2006
Location: Turkey
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote unitrakya Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2007 at 3:24pm
Recent Forum Posts
Error: An invalid character was found in text content.
 
i got this eror but i read from another topic that you will solve the problem in several weeks.
i will wait for you thanks borg ;)
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2007 at 9:09am
You need to be running version 9.05, but if you are using a non-western character set then these often do not work well with RSS Feeds.
Back to Top
lovelymanmk View Drop Down
Newbie
Newbie


Joined: 08 March 2003
Location: Qatar
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote lovelymanmk Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2007 at 8:11pm
I did this for last 10 posts...
 
I'd aslo like to know if there is any error this might cause. I tested it and it's working well... but forum experts' opinion is very appreciated
 

<%
' Last 10 posts
 
strSQL = "SELECT TOP 10 " & strDbTable  & "Author.Username, " & strDbTable  & "Author.Author_ID, " & strDbTable  & "Thread.Topic_ID, " & strDbTable  & "Thread.Thread_ID, " & strDbTable  & "Thread.Message_date, " & strDbTable  & "Topic.Subject, " & strDbTable  & "Topic.Forum_ID  " &_
  "FROM " & strDbTable  & "Author, (" & strDbTable  & "Thread INNER JOIN " & strDbTable  & "Topic ON " & strDbTable  & "Thread.Topic_ID = " & strDbTable  & "Topic.Topic_ID) INNER JOIN " & strDbTable  & "Forum ON " & strDbTable  & "Topic.Forum_ID = " & strDbTable  & "Forum.Forum_ID  " &_
  "WHERE " & strDbTable  & "Author.Author_ID = " & strDbTable  & "Thread.Author_ID  " &_
  "AND " & strDbTable  & "Topic.Forum_ID IN (SELECT " & strDbTable  & "Forum.Forum_ID FROM " & strDbTable  & "Forum WHERE " & strDbTable  & "Forum.[Hide] = 0  " &_
  "UNION  " &_
  "select " & strDbTable  & "Permissions.Forum_ID from " & strDbTable  & "Permissions WHERE (" & strDbTable  & "Permissions.Group_ID = " & intGroupID & " OR " & strDbTable  & "Permissions.Author_ID = " & lngLoggedInUserID & ")) " &_
  "AND " & strDbTable  & "Thread.Topic_ID IN (SELECT TOP 24 " & strDbTable  & "Topic.Topic_ID FROM " & strDbTable  & "Topic ORDER BY " & strDbTable  & "Topic.Last_Thread_ID DESC)  " &_
  "AND " & strDbTable  & "Forum.Password is NULL  " &_
  "ORDER BY " & strDbTable  & "Thread.Message_date DESC"
  
rsCommon.Open strSQL, adoCon
 
Dim sarryLFPost, nTotalRecs, intCurRecx
Dim x_Author_ID, x_Username, x_Topic_ID, x_Thread_ID, x_Subject, x_MsgDate, x_Forum_ID
 
if not rsCommon.eof then
      sarryLFPost = rsCommon.GetRows()
      nTotalRecs = Ubound(sarryLFPost,2) + 1
end if
rsCommon.Close
 
Do While (intCurRecx < nTotalRecs)
 
 x_Author_ID = CInt(sarryLFPost(1,intCurRecx))
 x_Username = sarryLFPost(0,intCurRecx)
 x_Topic_ID = sarryLFPost(2,intCurRecx)
 x_Thread_ID = sarryLFPost(3,intCurRecx)
 x_Subject = sarryLFPost(5,intCurRecx)
 x_MsgDate = sarryLFPost(4,intCurRecx)
 x_Forum_ID = sarryLFPost(6,intCurRecx)
 
 Response.Write("<div width=150 style=""float: right;"">" & "<a href=""member_profile.asp?PF=" & x_Author_ID & strQsSID2 & """ class=""smLink"" rel=""nofollow"">" & x_Username & "</a> <a href=""forum_posts.asp?TID=" & x_Topic_ID & "&PID=" & x_Thread_ID & "#" & x_Thread_ID & """><img src=""" & strImagePath & "view_last_post.png"" alt=""" & strTxtViewLastPost & """ title=""" & strTxtViewLastPost & """ /></a></div>" & "<div width=150 style=""float: left;"">" & " &nbsp;" & (DateFormat(x_MsgDate) & "&nbsp;" &  strTxtAt & "&nbsp;" & TimeFormat(x_MsgDate)) & "</div>" & "<div width=300 style=""float:center;"" align=""center"">" & "&nbsp;<a href=""forum_posts.asp?TID=" & x_Topic_ID & strQsSID2 & """ title=""" & x_Subject & """>" & TrimString(x_Subject, 35) & "</a></div><br>")
 
  intCurRecx = intCurRecx + 1
Loop
%> 


Edited by lovelymanmk - 02 October 2007 at 11:04pm
Back to Top
lovelymanmk View Drop Down
Newbie
Newbie


Joined: 08 March 2003
Location: Qatar
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote lovelymanmk Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2007 at 4:24pm
you should add this for not showing not approved post:
 
"AND " & strDbTable  & "Thread.Hide = 0  " &_
 
so it's gonna be like this:
 
 
strSQL = "SELECT TOP 10 " & strDbTable  & "Author.Username, " & strDbTable  & "Author.Author_ID, " & strDbTable  & "Thread.Topic_ID, " & strDbTable  & "Thread.Thread_ID, " & strDbTable  & "Thread.Message_date, " & strDbTable  & "Topic.Subject, " & strDbTable  & "Topic.Forum_ID  " &_
  "FROM " & strDbTable  & "Author, (" & strDbTable  & "Thread INNER JOIN " & strDbTable  & "Topic ON " & strDbTable  & "Thread.Topic_ID = " & strDbTable  & "Topic.Topic_ID) INNER JOIN " & strDbTable  & "Forum ON " & strDbTable  & "Topic.Forum_ID = " & strDbTable  & "Forum.Forum_ID  " &_
  "WHERE " & strDbTable  & "Author.Author_ID = " & strDbTable  & "Thread.Author_ID  " &_
  "AND " & strDbTable  & "Thread.Hide = 0  " &_
  "AND " & strDbTable  & "Topic.Forum_ID IN (SELECT " & strDbTable  & "Forum.Forum_ID FROM " & strDbTable  & "Forum WHERE " & strDbTable  & "Forum.[Hide] = 0  " &_
  "UNION  " &_
  "select " & strDbTable  & "Permissions.Forum_ID from " & strDbTable  & "Permissions WHERE (" & strDbTable  & "Permissions.Group_ID = " & intGroupID & " OR " & strDbTable  & "Permissions.Author_ID = " & lngLoggedInUserID & ")) " &_
  "AND " & strDbTable  & "Thread.Topic_ID IN (SELECT TOP 24 " & strDbTable  & "Topic.Topic_ID FROM " & strDbTable  & "Topic ORDER BY " & strDbTable  & "Topic.Last_Thread_ID DESC)  " &_
  "AND " & strDbTable  & "Forum.Password is NULL  " &_
  "ORDER BY " & strDbTable  & "Thread.Message_date DESC"
 
 
However, I'm still not sure from getting the last post. It goes to the post of the topic not the one you specifiy by pressing on the arrow. That's because of get_last_post.asp I guess...
Back to Top
bims View Drop Down
Groupie
Groupie
Avatar

Joined: 03 May 2004
Location: United Kingdom
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote bims Quote  Post ReplyReply Direct Link To This Post Posted: 08 October 2007 at 1:06pm
Is there a way to show only the last 10 topics? rather than posts? The things is i don't want all 10 links to be of the same topic if it's a heated one.

Back to Top
 Post Reply Post Reply Page  123 6>

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.