Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - REQ: Last 10 posts from a specific category
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

REQ: Last 10 posts from a specific category

 Post Reply Post Reply Page  12>
Author
maxim View Drop Down
Newbie
Newbie
Avatar

Joined: 05 September 2003
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote maxim Quote  Post ReplyReply Direct Link To This Post Topic: REQ: Last 10 posts from a specific category
    Posted: 23 November 2006 at 3:58pm
I've been using the old code for Last 10 Post by MadDog, and it works great. Right now I need to change that code so it shows last 10 posts from a specific category (forum) only.
 
here's the script i'm using now. What do I need to change....txn
 
<%
'#########################################################################
'##
'## Display Newest Forum Posts with WebWizForums v8.x
'##
'## Just configure the database settings and it will read the latest forum
'## posts. This file should be setup for your website.
'##
'## Mod from www.iportalx.net
'##
'## Writen by Drew Gauderman (aka MadDog)
'## Email: drew@aspinvision.com
'## Website: www.iportalx.net
'##
'## Dont want to do this yourself? Get iPortalX! A Portal with WebWizForum!
'## http://www.iportalx.net
'##
'#########################################################################

Dim rsCommon
Dim adoCon
Dim strCon
Dim strSQL
Dim strLastestPostsModTopicSubject
Dim strLastestPostsModForumPath
Dim intLastestPostsTotal
Dim strDatabaseType
Dim strDBTrue
Dim strDBFalse
'The path to the forum
strForumPath = "forum/"
'How many new topics to show
intLastestPostsTotal = 25
'//-----------------------------------------------------
'// Database connection and settings
'//-----------------------------------------------------
'Database settings for Access
'strDatabaseType = "Access"
'strDBTrue = "True"
'strDBFalse = "False"
'Database settings for MSSQL
strDatabaseType = "SQLServer"
strDBTrue = "1"
strDBFalse = "0"
'Database settings for MySQL
'strDatabaseType = "MySQL"
'strDBFalse = 0
'strDBTrue = -1
'Access connection
'strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database/wwForum.mdb")  'This one is for Access 2000/2002

'MSSQL Connection
Const strSQLServerName = "XXXXXXXXX 'Holds the name of the SQL Server (This is the name/location or IP address of the SQL Server)
Const strSQLDBUserName = "XXXXXXX" 'Holds the user name (for SQL Server Authentication)
Const strSQLDBPassword = "XXXXXXX" 'Holds the password (for SQL Server Authentication)
Const strSQLDBName = "forumwwf"
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
'//-----------------------------------------------------
'Start the database connection
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open strCon
'Start a recordset connection
Set rsCommon = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT "
If strDatabaseType = "SQLServer" OR strDatabaseType = "Access" Then strSQL = strSQL & " TOP " & intLastestPostsTotal & " "
strSQL = strSQL & "tblForum.Forum_name, tblTopic.Topic_ID, tblTopic.Subject, tblThread.Thread_ID, tblThread.Message_date, tblAuthor.Author_ID, tblAuthor.Username, tblThread.Message  " & _
    "FROM tblForum, tblTopic, tblAuthor, tblThread, tblPermissions " & _
    "WHERE tblForum.Forum_ID = tblTopic.Forum_ID " & _
        "AND tblTopic.Topic_ID = tblThread.Topic_ID " & _
        "AND tblAuthor.Author_ID = tblThread.Author_ID " & _
        "AND tblForum.Forum_ID = tblPermissions.Forum_ID " & _
        "AND (tblPermissions.Group_ID = 2 AND tblPermissions.View_Forum = " & strDBTrue & ") "
strSQL = strSQL & "AND (tblForum.Password = '' OR tblForum.Password Is Null) AND (tblTopic.Hide = " & strDBFalse & " AND tblThread.Hide = " & strDBFalse & ") ORDER BY tblThread.Message_date DESC "
'mySQL limit operator
If strDatabaseType = "mySQL" Then strSQL = strSQL & " LIMIT " & intLastestPostsTotal
strSQL = strSQL & ";"
rsCommon.Open strSQL, adoCon
If NOT rsCommon.EOF Then saryForumPosts = rsCommon.getRows()
'Close all connections, very important!!
rsCommon.Close
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
 
'No forum posts
If IsArray(saryForumPosts) = False Then
    Response.Write "<span class=""text_arial"">No Forum Posts Made</span>"
'Forum posts have been made
Else
    'Loop through the array of forum posts
    For intLoopCounter = 0 TO UBound(saryForumPosts, 2)
        'saryForumPosts array lookup table
        '0 = tblForum.Forum_name
        '1 = tblTopic.Topic_ID
        '2 = tblTopic.Subject
        '3 = tblThread.Thread_ID
        '4 = tblThread.Message_date
        '5 = tblAuthor.Author_ID
        '6 = tblAuthor.Username
        '7 = tblThread.Message
        strLastestPostsModTopicSubject = saryForumPosts(2, intLoopCounter)
        'Crop the subject down to 18 characters
        If Len(strLastestPostsModTopicSubject) > 18 then strLastestPostsModTopicSubject = Left(strLastestPostsModTopicSubject,30) & "..."
        Response.Write("<font face=Arial, Helvetica, sans-serif size=2><a href=""" & strForumPath & "forum_posts.asp?TID=" & saryForumPosts(1, intLoopCounter) & """target=_blank>" & strLastestPostsModTopicSubject & "</a></font><br />")
    Next
End If
%>
Back to Top
gölge View Drop Down
Groupie
Groupie


Joined: 16 April 2005
Location: Turkey
Status: Offline
Points: 182
Post Options Post Options   Thanks (0) Thanks(0)   Quote gölge Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2006 at 8:34pm
first you must find  forum id that you want to specify. you can learn it from forum link. for example FID=25.
then after that codes:
 
"AND tblTopic.Topic_ID = tblThread.Topic_ID " & _
"AND tblAuthor.Author_ID = tblThread.Author_ID " & _
"AND tblForum.Forum_ID = tblPermissions.Forum_ID " & _
 
add that bold code :
 
"AND tblForum.Forum_ID = 25 " & _
 
like that;
 
"AND tblTopic.Topic_ID = tblThread.Topic_ID " & _
"AND tblAuthor.Author_ID = tblThread.Author_ID " & _
"AND tblForum.Forum_ID = tblPermissions.Forum_ID " & _
"AND tblForum.Forum_ID = 25 " & _
 
change 25 to forum id  that you want...
Back to Top
coolguy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 November 2006
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote coolguy Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2006 at 10:26pm
golge,
 
Any way we make this code run in Marque style if you know what I mean.
Back to Top
gölge View Drop Down
Groupie
Groupie


Joined: 16 April 2005
Location: Turkey
Status: Offline
Points: 182
Post Options Post Options   Thanks (0) Thanks(0)   Quote gölge Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2006 at 1:03am
Originally posted by coolguy coolguy wrote:

golge,
 
Any way we make this code run in Marque style if you know what I mean.
 
sorry i cant understand!
Back to Top
javi712 View Drop Down
Senior Member
Senior Member


Joined: 22 May 2003
Location: United States
Status: Offline
Points: 488
Post Options Post Options   Thanks (0) Thanks(0)   Quote javi712 Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2006 at 5:51am
a marquee is scrolling text within a specific area on a webpage. i'm guessing coolguys wants to know if the last 10 posts can be made in a way that it shows up scrolling on the webpage.

coolguy... for a simple marquee you can just add the html code to it to make it scroll....

Response.Write("<marquee width=""20%""><font face=Arial, Helvetica, sans-serif size=2><a href=""" & strForumPath & "forum_posts.asp?TID=" & saryForumPosts(1, intLoopCounter) & """target=_blank>" & strLastestPostsModTopicSubject & "</a></font><br /></marquee>")


Edited by javi712 - 25 November 2006 at 5:55am
Back to Top
coolguy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 November 2006
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote coolguy Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2006 at 6:23am
javi712, I did what you said but the result was all 10 posts scrolling at the same time and not one after the other as in a marque.
Back to Top
javi712 View Drop Down
Senior Member
Senior Member


Joined: 22 May 2003
Location: United States
Status: Offline
Points: 488
Post Options Post Options   Thanks (0) Thanks(0)   Quote javi712 Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2006 at 6:28am
coolguy - that was just for a simple html scrolling marquee.

to achieve what you are looking for, i believe you will need a javascript snippet. unforunately i'm not very knowledgeable in javascript/asp integration... so maybe one of the other programming guys can give you a bit more help.
Back to Top
coolguy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 November 2006
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote coolguy Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2006 at 7:28am

Thanks, I wounder if it can be done using the build in RSS feed, I saw a web page using the RSS feed as a scrolling marquee. I dont know how they did it.

Back to Top
 Post Reply Post Reply Page  12>

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.