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/O Code)
 Author
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Darkness
Junior Member

Italy
145 Posts

Posted - 22 February 2003 :  20:48:16  Show Profile  Visit Darkness's Homepage
I have this code:

<%

ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../mdb-database/snitz_forums_2000.mdb")
function getlast_topics(numdays)
set tConn= Server.CreateObject("ADODB.Connection")
tConn.Open ConnString
strSql = "SELECT TOP "&numdays&" T_AUTHOR,T_LAST_POST,T_REPLIES,T_LAST_POSTER,T_DATE, T_SUBJECT,TOPIC_ID,FORUM_ID,CAT_ID from FORUM_TOPICS where T_STATUS = 1 order by T_LAST_POST DESC"
CColor=strForumCellColor
set rss = tConn.Execute (strSql)
do until rss.eof
tID=rss("TOPIC_ID")
tPOSTER=rss("T_LAST_POSTER")
tDATE=rss("T_DATE")
tSUBJECT=rss("T_SUBJECT")
tLastPost=rss("T_LAST_POST")
tReplies=rss("T_REPLIES")
strlast =strlast&"<tr><td onMouseOver=""this.style.background='#333333';"" onMouseOut=""this.style.background='#FFFFFF';"" style=""cursor: hand"" bgcolor=""#FFFFFF"" onClick=""window.location.href='link.asp?TOPIC_ID="&tID&"'"" height=""18"" class=""button"">" &vbcrlf
strlast =strlast&"<div align=""left"" class=""button (unavailable)"">"&ChkIsNew3(tLastPost,tReplies)&"<font face=""Veranda, Arial, Helvetica, san-serif"" size=""1""><a href=""link.asp?TOPIC_ID="&tID&""" class=""button (unavailable)""><small>"&tSUBJECT&"</small></a></font></div>"&vbcrlf
strlast =strlast&"</td></tr>"&vbcrlf
rss.movenext
loop
rss.close
set rss=nothing
tConn.close
set tConn=nothing
getlast_topics=strlast
end function

Function ChkIsNew3(dt,replies)
'## if you did'nt have config.asp including in this page, set some variables here again.
intHotTopicNum = 20
strHotTopic = "1"
'## if you Set Cookie to Forum, and this page did'nt in forum folder, maybe need some modify below line...
strCookieURL = Left(Request.ServerVariables("Path_Info"), InstrRev(Request.ServerVariables("Path_Info"), "/"))
if dt > Session(strCookieURL & "last_here_date") then
	if replies >= 5 and lcase(strHotTopic) = "1" then
	ChkIsNew3 = "<img src='icon_folder_new_hot.gif' height='17' width='15' align='absmiddle' hspace='2' alt='Hot Topic'>"
	else
	ChkIsNew3 = "<img src='icon_folder_new.gif' height='15' width='15' align='absmiddle' hspace='2' alt='New Topic'>"
	end if
elseif replies >= 5 and lcase(strHotTopic) = "1" then
	ChkIsNew3 = "<img src='icon_folder_hot.gif' height='17' width='15' align='absmiddle' hspace='2' alt='Hot Topic'>"
else
	ChkIsNew3 = "<img src='icon_folder.gif' height='15' width='15' align='absmiddle' hspace='2'>"
end if
End Function

%>

How can i add the author of the post?
And how can i select only post from forum_id=2=

Darkness
Junior Member

Italy
145 Posts

Posted - 24 February 2003 :  17:19:09  Show Profile  Visit Darkness's Homepage
Ok, i only have to add the author now.
Please help me, is too hard for me...
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 25 February 2003 :  10:04:05  Show Profile  Visit MarcelG's Homepage
to select only this from forumid=2 use this

strSql = "SELECT TOP "&numdays&" T_AUTHOR,T_LAST_POST,T_REPLIES,T_LAST_POSTER,T_DATE, T_SUBJECT,TOPIC_ID,FORUM_ID,CAT_ID from FORUM_TOPICS where T_STATUS = 1 and WHERE FORUM_ID=2 order by T_LAST_POST DESC"


to display the author, use the same as with the last_post_author:
tPOSTER=rss("T_LAST_POSTER")

so,
tAUTHOR=rss("T_AUTHOR")




portfolio - linkshrinker - oxle - twitter

Edited by - MarcelG on 25 February 2003 10:04:34
Go to Top of Page

Darkness
Junior Member

Italy
145 Posts

Posted - 25 February 2003 :  13:28:33  Show Profile  Visit Darkness's Homepage
It shows the ID of the Author, not the name..
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 25 February 2003 :  15:15:54  Show Profile  Visit MarcelG's Homepage
Darkness,

that's right, tAUTHOR shows you the ID of the author.
what about getMemberName(tAUTHOR), or chkString(tAUTHOR,"display")

portfolio - linkshrinker - oxle - twitter
Go to Top of Page

Darkness
Junior Member

Italy
145 Posts

Posted - 26 February 2003 :  07:10:54  Show Profile  Visit Darkness's Homepage
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.



Edited by - Darkness on 26 February 2003 07:17:42
Go to Top of Page

Darkness
Junior Member

Italy
145 Posts

Posted - 26 February 2003 :  07:29:19  Show Profile  Visit Darkness's Homepage
Now I have this:

<%
function getMemberName(fUser_Number)

my_Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../../../../mdb-database/snitz_forums_2000.mdb")

dim strSql
dim rsGetmemberName

'## Forum_SQL
if isNull(fUser_Number) then exit function
strSql = "SELECT M_NAME "
strSql = strSql & " FROM FORUM_MEMBERS "
strSql = strSql & " WHERE MEMBER_ID = " & cLng(fUser_Number)

set rsGetMemberName = Server.CreateObject("ADODB.Recordset")
rsGetMemberName.open strSql, my_Conn

if rsGetMemberName.EOF or rsGetMemberName.BOF then
getMemberName = ""
else
getMemberName = chkString(rsGetMemberName("M_NAME"),"display")
end if

rsGetMemberName.close
set rsGetMemberName = nothing

end function
%>

<%

ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../../../../mdb-database/snitz_forums_2000.mdb")
function getlast_topics_id2(numdays)
set tConn= Server.CreateObject("ADODB.Connection")
tConn.Open ConnString
strSql = "SELECT TOP "&numdays&" T_AUTHOR,T_LAST_POST,T_REPLIES,T_LAST_POSTER,T_DATE, T_SUBJECT,TOPIC_ID,FORUM_ID,CAT_ID from FORUM_TOPICS where T_STATUS = 1 and FORUM_ID = 2 order by T_LAST_POST DESC"
CColor=strForumCellColor
set rss = tConn.Execute (strSql)
do until rss.eof
tID=rss("TOPIC_ID")
tPOSTER=rss("T_LAST_POSTER")
tDATE=rss("T_DATE")
tSUBJECT=rss("T_SUBJECT")
tLastPost=rss("T_LAST_POST")
tReplies=rss("T_REPLIES")
tFid=rss("Forum_ID")
Anno = left(tLastPost,4)
Mese = mid(tLastPost,5,2)
Giorno = mid(tLastPost,7,2)
Ora = mid(tLastPost,9,2)
Minuti = mid(tLastPost,11,2)
Secondi= mid(tLastPost,13,2)
strlast =strlast&"<tr bgcolor=#000000><td onClick=""window.location.href='../link.asp?TOPIC_ID="&tID&"'"" height=""18"" class=""button"">" &vbcrlf
strlast =strlast&"<div align=""left"" class=""button (unavailable)"">"&ChkIsNew3(tLastPost,tReplies)&"<font face=""Veranda, Arial, Helvetica, san-serif"" size=""1"">"&Giorno&"/"&Mese&"/"&Anno&"::"&Ora&":"&Minuti&":"&Secondi&" <a href=""../link.asp?TOPIC_ID="&tID&""" class=""button (unavailable)""><small>"&tSUBJECT&"</small></a> By " & getMemberName(tPOSTER) & "</font></div>"&vbcrlf
strlast =strlast&"</td></tr>"&vbcrlf
rss.movenext
loop
rss.close
set rss=nothing
tConn.close
set tConn=nothing
getlast_topics_id2=strlast
end function

Function ChkIsNew3(dt,replies)
'## if you did'nt have config.asp including in this page, set some variables here again.
intHotTopicNum = 20
strHotTopic = "1"
'## if you Set Cookie to Forum, and this page did'nt in forum folder, maybe need some modify below line...
strCookieURL = Left(Request.ServerVariables("Path_Info"), InstrRev(Request.ServerVariables("Path_Info"), "/"))
if dt > Session(strCookieURL & "last_here_date") then
if replies >= 5 and lcase(strHotTopic) = "1" then
ChkIsNew3 = "<img src='../icon_folder_new_hot.gif' height='17' width='15' align='absmiddle' hspace='2' alt='Hot Topic'>"
else
ChkIsNew3 = "<img src='../icon_folder_new.gif' height='15' width='15' align='absmiddle' hspace='2' alt='New Topic'>"
end if
elseif replies >= 5 and lcase(strHotTopic) = "1" then
ChkIsNew3 = "<img src='../icon_folder_hot.gif' height='17' width='15' align='absmiddle' hspace='2' alt='Hot Topic'>"
else
ChkIsNew3 = "<img src='../icon_folder.gif' height='15' width='15' align='absmiddle' hspace='2'>"
end if
End Function

%>

<table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="#FFFFFF">
<% =getlast_topics_id2(5) %>
</table>


But it does not work :°(
Go to Top of Page

Darkness
Junior Member

Italy
145 Posts

Posted - 11 March 2003 :  18:53:28  Show Profile  Visit Darkness's Homepage
Plese... :°(
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 12 March 2003 :  12:54:10  Show Profile
hi~ Darkness,

the data field T_LAST_POSTER seem no used on v3.4...
if you want to get the last post author id, you should use T_LAST_POST_AUTHOR

and by your code now, try this....
change the line SQL string to
strSql = "SELECT TOP " & numdays & " T.T_LAST_POST, T.T_REPLIES, T.T_LAST_POSTER, "
strSql = strSql & "T.T_DATE,  T.T_SUBJECT, T.TOPIC_ID, M.M_NAME "
strSql = strSql & "FROM FORUM_TOPICS T LEFT JOIN FORUM_MEMBERS M ON T.T_LAST_POST_AUTHOR = M.MEMBER_ID "
strSql = strSql & "WHERE T.T_STATUS = 1 "
if forumid > 0 then strSql = strSql & "AND T.FORUM_ID = " & forumid & " "
strSql = strSql & "ORDER BY T.T_LAST_POST DESC"

and add one line...
tID=rss("TOPIC_ID")
tAuthorName=rss("M_NAME")
tPOSTER=rss("T_LAST_POSTER")

then you can get the author name by...
just replace this getMemberName(tPOSTER) to tAuthorName
(not sure what you want to show is Topic Author or Last Post Author ?
if the former, just change T_LAST_POST_AUTHOR to T_AUTHOR in strSql.)

and if you want to specify a custom forum_id...
change function getlast_topics_id2(numdays) to getlast_topics_id2(numdays,forumid)
then use getlast_topics_id2(5,2) to get what you want.
(2 is a FORUM_ID number, use 0 for all forums.. but be careful, it did'nt check private forum issue.)

try and see if it work for you..

these code is simple but may useful for showing lastest xx topics on a page outer the forum.
you can take a reference to active.asp code, it's a good example to learn how to write the lastest xx Sql string.

and maybe you also can try the Content Display or Syndicate.....and so on.
it seem a lots Mods can do this job easily and more features.

Edited by - DoraMoon on 12 March 2003 12:56:07
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07