Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Job to grab X number recent posts and put in UL
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

AnonJr
Moderator

United States
5768 Posts

Posted - 26 January 2007 :  06:14:47  Show Profile  Visit AnonJr's Homepage  Reply with Quote
Cool.<
Go to Top of Page

runsh
Starting Member

34 Posts

Posted - 26 January 2007 :  11:00:33  Show Profile  Visit runsh's Homepage  Reply with Quote
looks good.
thanks<
Go to Top of Page

garyrobar
New Member

Canada
90 Posts

Posted - 26 January 2007 :  18:09:53  Show Profile  Visit garyrobar's Homepage  Reply with Quote
quote:
Originally posted by MrsJJenson

Is any coding suppose to go in the inc_forumrecentpost.asp? I don't see any new posts on my homepage where I would like it to show. What did i do wrong or need to do?





Just download the file from my recent post (3 posts above) and use that one instead. Its dynamic, and you just include it where you want to show the list.<

SEO For Snitz Forum
Go to Top of Page

MrsJJenson
Starting Member

USA
3 Posts

Posted - 26 January 2007 :  18:21:21  Show Profile  Reply with Quote
k, so i downloaded the file from above and created the blank
inc_forumrecentpost.asp. Then i changed the files paths in line
5&6 and changed the url path on line 76. then I uploaded the two
files to my site and where I want the recent posts to show on my homepage they are not showing.
<!-- INCLUDE FILE=forum/inc_forumrecentpost.asp --> this needs to be
where I want the recent posts to show, correct? What else do I need to do to fix this?<

Edited by - MrsJJenson on 26 January 2007 18:22:48
Go to Top of Page

garyrobar
New Member

Canada
90 Posts

Posted - 26 January 2007 :  22:02:44  Show Profile  Visit garyrobar's Homepage  Reply with Quote
the file you just downloaded is a separate version. The folks who posted earlier wanted one that you didn't have to update manually. So, just download that most recent one a few posts up, and make the changes. Then use a server side include wehreever you wanted the list to appear. no need to do anything else.<

SEO For Snitz Forum
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 27 January 2007 :  11:47:53  Show Profile  Visit JJenson's Homepage  Reply with Quote
Looks good gary, One thing to make it work on my site I had to remove the option explicit on the top. Now everything works just as it should. I don't think its needed but i could be wrong.

<
Go to Top of Page

garyrobar
New Member

Canada
90 Posts

Posted - 27 January 2007 :  14:21:51  Show Profile  Visit garyrobar's Homepage  Reply with Quote
Glad you like!

Option Explicit isn't really needed.

It just forces you to code properly. if you have any undeclared variables anywehre on the page you are executing, you'll get errors with option explicit.<

SEO For Snitz Forum
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 27 January 2007 :  19:44:15  Show Profile  Visit JJenson's Homepage  Reply with Quote
Yeah figured it was something like that. Now I know you didn't make it this way but h ow hard would it be to convert to only topics from a certain forum get posted? I was trying to do this and changed the url and that didn't work and figured it owuld be a little more difficult than with my knowledge. But I will take a stab at it.<
Go to Top of Page

garyrobar
New Member

Canada
90 Posts

Posted - 27 January 2007 :  21:15:15  Show Profile  Visit garyrobar's Homepage  Reply with Quote
actuallly, you should change the SQL statement to only grab from records of a certain forum id- are you familliar with SQL?<

SEO For Snitz Forum
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 27 January 2007 :  21:18:06  Show Profile  Visit JJenson's Homepage  Reply with Quote
Not really no I am just now starting to expand my knowledge in these areas. Maybe give me an example and I should be able to take it from there? Thanks<
Go to Top of Page

garyrobar
New Member

Canada
90 Posts

Posted - 29 January 2007 :  11:03:23  Show Profile  Visit garyrobar's Homepage  Reply with Quote
okay so make these adjustments to display only posts from ONE forum...

Change this...

intResults = 10
intAge = 30
lastDate = DateToStr(DateAdd("d",-(intAge),Now()))
strMethod = "last_post"
subjectlength = 122
subjectlengthe = 60
intPage = 1


to this...

intResults = 10
intAge = 30
lastDate = DateToStr(DateAdd("d",-(intAge),Now()))
strMethod = "last_post"
subjectlength = 122
subjectlengthe = 60
intPage = 1
displayForum = 26 'enter the FORUM_ID, put 111111 for display all.


and then change the SQL statements from this...


strSql = "SELECT F.F_SUBJECT, T.TOPIC_ID, T.T_AUTHOR, T.T_SUBJECT, T.T_MESSAGE"
strSql = strSql & ", T.T_LAST_POST, T.T_LAST_POST_REPLY_ID, T.T_REPLIES, T.T_DATE, M.M_NAME"
strSql = strSql & ", MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME"
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM F LEFT JOIN " & strTablePrefix & "TOPICS T"
strSql = strSql & " ON F.FORUM_ID = T.FORUM_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " ON T.T_AUTHOR = M.MEMBER_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS MEMBERS_1"
strSql = strSql & " ON T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID"
strSql = strSql & " WHERE T.T_STATUS < 2 ORDER BY T.T_LAST_POST DESC"


to this...


strSql = "SELECT F.F_SUBJECT, T.TOPIC_ID, T.T_AUTHOR, T.T_SUBJECT, T.T_MESSAGE"
strSql = strSql & ", T.T_LAST_POST, T.T_LAST_POST_REPLY_ID, T.T_REPLIES, T.T_DATE, M.M_NAME"
strSql = strSql & ", MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME"
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM F LEFT JOIN " & strTablePrefix & "TOPICS T"
strSql = strSql & " ON F.FORUM_ID = T.FORUM_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " ON T.T_AUTHOR = M.MEMBER_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS MEMBERS_1"
strSql = strSql & " ON T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID"

if displayforum <> 111111 then
strSql = strSql & " WHERE T.T_STATUS < 2"
strSql = strSql & " AND F.FORUM_ID = " & displayForum & " ORDER BY T.T_LAST_POST DESC"
else
strSql = strSql & " WHERE T.T_STATUS < 2 ORDER BY T.T_LAST_POST DESC"
end if
<

SEO For Snitz Forum
Go to Top of Page

runsh
Starting Member

34 Posts

Posted - 29 January 2007 :  19:13:56  Show Profile  Visit runsh's Homepage  Reply with Quote
thanks for changing it. works great. I was wondering if is possible to change it bit more so to allow category (all forums in cat. to display).
<
Go to Top of Page

garyrobar
New Member

Canada
90 Posts

Posted - 29 January 2007 :  21:17:38  Show Profile  Visit garyrobar's Homepage  Reply with Quote
Yes, it is. We just need to do two things:

1 - Add a variable called "displayCat" and set it equal to the category ID of the category you want to display.
2 - Find the "WHERE" clause:


if displayforum <> 111111 then
strSql = strSql & " WHERE T.T_STATUS < 2"
strSql = strSql & " AND F.FORUM_ID = " & displayForum & " ORDER BY T.T_LAST_POST DESC"
else
strSql = strSql & " WHERE T.T_STATUS < 2 ORDER BY T.T_LAST_POST DESC"
end if


...and change it to


if displayforum <> 111111 then
strSql = strSql & " WHERE T.T_STATUS < 2"
strSql = strSql & " AND F.CAT_ID = " & displayCat & " ORDER BY T.T_LAST_POST DESC"
else
strSql = strSql & " WHERE T.T_STATUS < 2 ORDER BY T.T_LAST_POST DESC"
end if


SQL is actually quite logical. The "WHERE" clause just helps you narrow down the chink of records you are grabbing from the database. SO, if you only want records from say, category ID 7, the SQL essentially says:

"get me (select) all records from the certain tables that have the data I need, and only get me records WHERE some condition is true. (cat_id = 7)"

Hope this helps.<

SEO For Snitz Forum
Go to Top of Page

runsh
Starting Member

34 Posts

Posted - 30 January 2007 :  00:29:36  Show Profile  Visit runsh's Homepage  Reply with Quote
great mod.
thanks<
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.46 seconds. Powered By: Snitz Forums 2000 Version 3.4.07