Author |
Topic |
acoustika
Junior Member
Denmark
311 Posts |
Posted - 19 November 2003 : 00:49:58
|
Hey there
I have used and modified a bit the code from Richard's link
quote: -------------------------------------------------------------------------------- try here: http://forum.snitz.com/forum/link.asp?TOPIC_ID=7032 -------------------------------------------------------------------------------- I couldn't post in that Topic, because it was closed. Don't know why.
Now I have a little request, Could someone please help me make so it also shows WHO posted the topic.
My code is as follows, the little script can be seen in use here
www.uniquedk.dk/forum/f_news2.asp <---- this is the newest one
CODE:
<!--#INCLUDE FILE="config.asp"--> <!--#INCLUDE file="inc_func_secure.asp" --> <!--#INCLUDE file="inc_sha256.asp"--> <% connString = strConnstring function getlast_topics(numdays) set tConn= Server.CreateObject("ADODB.Connection") tConn.Open ConnString
''''''''''''''''''''''''''''''''''''' ''Don't display if from private forum ''''''''''''''''''''''''''''''''''''' set PrivateForum = tConn.Execute("select FORUM_ID from FORUM_FORUM where F_PRIVATEFORUMS = 6") SQL = "SELECT TOP " & numdays & " * from FORUM_TOPICS WHERE " do until PrivateForum.eof SQL = SQL & "FORUM_ID <> " & PrivateForum("FORUM_ID") & " and " PrivateForum.movenext Loop '''''''''''''''''
strSql = "SELECT TOP " & numdays & " T_AUTHOR,T_LAST_POST,T_LAST_POSTER,T_DATE,T_SUBJECT,TOPIC_ID,FORUM_ID,CAT_ID from FORUM_TOPICS order by T_LAST_POST DESC" CColor = strForumCellColor set rss = tConn.Execute (strSql)
response.write "<tr><td bgcolor=""" & strCategoryCellColor & """ height=""24"" align=""center"">Nyeste Forum Indlæg</td></tr>" & vbnewline
do until rss.eof tID = rss("TOPIC_ID") tPOSTER = rss("T_LAST_POSTER") tDATE = rss("T_DATE") tSUBJECT = rss("T_SUBJECT") strlast = strlast & "<tr><td onMouseOver=""this.style.background='" & strForumFirstcellcolor & "';"" onMouseOut=""this.style.background='"& CColor &"';"" style=""cursor: hand"" bgcolor=" & CColor & " onClick=""window.location.href='/forum/link.asp?TOPIC_ID=" & tID & "'"" height=""18"" class=""button"">" & vbcrlf strlast = strlast & "<div align=""left"" class=""button (unavailable)""><font face=""Veranda, Arial, Helvetica, san-serif"" size=""1"">Emne: <a href=""link.asp?TOPIC_ID=" & tID & """ class=""button (unavailable)"" target=""_blank""><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 %> <table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="#333333"> <%=getlast_topics(5)%> </table>
|
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
Edited by - acoustika on 26 November 2003 20:36:26 |
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 19 November 2003 : 01:06:25
|
And of course also the date would be nice *S*
I had startet it myself, but am not so strong i ASP so I gave up, though I learned something new. ;-) Thanks snitz for being such a resource in new lessons *GG*
|
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 19 November 2003 : 12:46:38
|
I'm not very good at this sql stuff and I'm not sure what you want, so I just added the member name to the sql (the date is already there). I test on mySql and I couldn't get TOP "&numdays&" to work so I took it out and added a count. I also took out the private forum code because I don't know anything about it . Look at the code, it might get you a little closer to what you want .
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE file="inc_func_secure.asp" -->
<!--#INCLUDE file="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_func_common.asp" -->
<%
' Include "inc_func_common.asp" above if "INC_HEADER.ASP" is not included!!! (Needed for the ChkDate and ChkString functions)
connString = strConnstring
function getlast_topics()
set tConn= Server.CreateObject("ADODB.Connection")
tConn.Open ConnString
'''''''''''''''''''''''''''''''''''''
''Don't display if from private forum
'''''''''''''''''''''''''''''''''''''
'''''''''''''''''
strSql = "SELECT " & strMemberTablePrefix & "Members.MEMBER_ID, " & strMemberTablePrefix & "Members.M_NAME, "
strSql = strSql & strTablePrefix & "Topics.T_AUTHOR, " & strTablePrefix & "Topics.T_LAST_POST, " & strTablePrefix & "Topics.T_LAST_POSTER, "
strSql = strSql & strTablePrefix & "Topics.T_DATE, " & strTablePrefix & "Topics.T_SUBJECT, " & strTablePrefix & "Topics.TOPIC_ID, "
strSql = strSql & strTablePrefix & "Topics.FORUM_ID, " & strTablePrefix & "Topics.CAT_ID"
strSql = strSql & " FROM " & strMemberTablePrefix & "Members ," & strTablePrefix & "Topics"
strSql = strSql & " WHERE " & strTablePrefix & "Topics.T_AUTHOR = " & strMemberTablePrefix & "Members.MEMBER_ID"
strSql = strSql & " ORDER BY " & strTablePrefix & "Topics.T_LAST_POST DESC"
CColor = strAltForumCellColor
set rss = tConn.Execute (strSql)
response.write "<tr><td bgcolor=""" & strCategoryCellColor & """ height=""24"" align=""center"">Nyeste Forum Indlæg</td></tr>" & vbnewline
dim tCount, tTopics
tTopics = 5 ' Set to number of topics shown
tTopics = tTopics + 1
tCount = 1
do until rss.eof or tTopics = tCount
tID = ChkString(rss("TOPIC_ID"),"display")
tPOSTER = ChkString(rss("T_LAST_POSTER"),"display")
tDATE = ChkDate(rss("T_DATE"), " at " ,true)
tAuthor = ChkString(rss("M_NAME"),"display")
tSUBJECT = ChkString(rss("T_SUBJECT"),"display")
strlast = strlast & "<tr><td onMouseOver=""this.style.background='" & strForumFirstcellcolor & "';"" onMouseOut=""this.style.background='"& CColor &"';"" style=""cursor: hand"" bgcolor=" & CColor & " onClick=""window.location.href='/forum/link.asp?TOPIC_ID=" & tID & "'"" height=""18"" class=""button"">" & vbcrlf
strlast = strlast & "<div align=""left"" class=""button (unavailable)""><font face=""Veranda, Arial, Helvetica, san-serif"" size=""1"">Emne: <a href=""link.asp?TOPIC_ID=" & tID & """ class=""button (unavailable)"" target=""_blank""><small>" & tSUBJECT & "</a> by " & tAuthor & " on " & tDate & "</small></font></div>" & vbcrlf
strlast = strlast & "</td></tr>" & vbcrlf
tCount = tCount + 1
rss.movenext
loop
rss.close
set rss=nothing
tConn.close
set tConn=nothing
getlast_topics=strlast
end function
%>
<table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="#333333">
<%=getlast_topics()%>
</table>
|
_-/Cripto9t\-_ |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 19 November 2003 : 15:35:33
|
Very Nice
Thanks alot cripto9t it works like a charm. 'bout the private forum stuff, it was also some code frem the topics I mentioned and basically I think its checks the news in these forums too but are NOT showing them.
Thanls for making it, I can see that my giving up also had something with the Inc_func_common thing *SS*. I'm not strong in ASP but am leaning every day, I can see on your code that I was heading in the right direction, Thanks alot *S* |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 20 November 2003 : 07:10:08
|
I'm learning 2
I just seen something. That code gives you the last 5 topics that have been replied to. If you want the last 5 topics regardless of the replies, you need to changestrSql = strSql & " ORDER BY " & strTablePrefix & "Topics.T_LAST_POST DESC" tostrSql = strSql & " ORDER BY " & strTablePrefix & "Topics.TOPIC_ID DESC" |
_-/Cripto9t\-_ |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 20 November 2003 : 23:10:07
|
Okay Thanks again ;-)
I was wondering, Is it possibel to use a script like this as an external newsticker for oter websites to use??? or would it crash if alot of sites were using the same page
Im thinking to let them use a thing like this as some referal code they have to insert on their page(s) |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 24 November 2003 : 23:02:14
|
Hmmm this script would be nice If I could get it to work outside my forum, heeelp
I get this error
ADODB.Recordset error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/forum/inc_func_common.asp, line 341
I have included the file on my main page and cookies are set to website, what is wrong??? |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 24 November 2003 : 23:30:32
|
????? I'm using an access (though I'm planning on upgrading when I'm done with the forum)
Can you plese write out what it is I am todo. ;-)
the script works fine for me in the forum folder, by the way. |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
Edited by - acoustika on 24 November 2003 23:31:05 |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 25 November 2003 : 06:29:18
|
If you are outside the forum folder you need a virtual path for all your includes.
<!--#INCLUDE VIRTUAL="/forum_folder/config.asp" -->
<!--#INCLUDE VIRTUAL="/forum_folder/inc_func_secure.asp" -->
etc....
quote: the Snitz code includes a beautiful little function called TopSQL
Thanks OneWayMule . |
_-/Cripto9t\-_ |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 25 November 2003 : 07:15:41
|
hmmm, still can't get it to work, the same error, I have now included the file with a virtual. I have tried both including the file, and writing the script directly on my startpage, My index page are a top and a bottom frame It is on the Bottom fram I want the script, can it be because of the frames???
you can see the error here www.uniquedk.dk/index.htm |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
Edited by - acoustika on 25 November 2003 07:21:32 |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 25 November 2003 : 10:18:49
|
I don't have any help for you this time . The code I posted above works outside the forum folder on the same server. I don't know anything about frames. The files are there, I see your table header and the lang. files in your source. I usually get that type of error when I don't call a function right (leave out a comma or quote etc...), but you say it works in the forum folder. Maybe post a text link to the asp file? |
_-/Cripto9t\-_ |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 25 November 2003 : 12:03:27
|
well the ASP file is the one you posted in this thred and the file is in action IN the forum folder in my first post, the one www.uniquedk.dk/forum/f_news2.asp is the same as on my index page |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 25 November 2003 : 23:12:45
|
Well now I have tested the first script, the one in the first post, and THAT one works outside my forum, maybe that can help in the error search, Bu t Im not quiet sure why that one works. |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
acoustika
Junior Member
Denmark
311 Posts |
Posted - 26 November 2003 : 07:53:24
|
Yuppiee I made it work, insted of including Inc_Func_common I included Inc_Header_Short.asp I don't know if it's because My cookie thing ain't Configured right, but now it's working *S*, Thanka alot again, cause now It's like I want it to be ;-) |
May The Code Be With You www.UniqueDk.dk *** The Open Forums of Denmark *** |
|
|
RebelTech
Average Member
USA
613 Posts |
Posted - 26 November 2003 : 10:19:15
|
acoustika, do you have a link so I could see this thing in action?
|
|
|
Topic |
|