T O P I C R E V I E W |
niceman |
Posted - 30 March 2009 : 13:28:40 Hi,
I found this old FAQ post, and tried it with the latest version, but it doesnt work.
Is there an update to it or any other useful answer?
http://forum.snitz.com/Forum/topic.asp?TOPIC_ID=21726
Thanks
Soeren Vestergaard
<moved from="Help: General / Current Version (v3.4.xx)" by="Shaggy" /> |
9 L A T E S T R E P L I E S (Newest First) |
HuwR |
Posted - 02 April 2009 : 02:40:39 TopSQL is not for MySQL, topSQL is a function which checks what db you are using and then creates the correct SQL expression for your database type.
it is in one of the snitz include files (inc_func_common.asp), so you must include it on the page you are trying to include this code in otherwise it will not work. |
niceman |
Posted - 02 April 2009 : 01:40:48 Allright, I testes it again, with this setting:
'on error resume next
on error goto 0
And got this error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'TopSQL'
/forum/inc_last_x_topics.inc, line 153
TopSQL is used for MySQL, but I dont use that.
How do I remove the MySQL code or what should I do?
|
AnonJr |
Posted - 01 April 2009 : 18:35:11 The error kinda says it all - it took too long to run and the server stopped running it. You can change the max time allowed to run in the two places mentioned in the error code. How many posts are you trying to pull? If you're trying to pull more than 5 or 10, and/or have a heavily trafficked site you'll run into some issues with Access not being able to keep up. |
niceman |
Posted - 01 April 2009 : 17:54:42 Someone have an answer for the timeout I described?
I use Access. |
niceman |
Posted - 30 March 2009 : 16:10:35 It helped a bit, but know I get this error:
|
HuwR |
Posted - 30 March 2009 : 15:58:21 that is the forum trying to parse some code in one of the functions (we really need to implement a noparse tag here, to get around it, use the reply with quote button on carefree's post and then just select the text that is inside the [code] tags |
niceman |
Posted - 30 March 2009 : 15:20:05 It seems your code has some lines which alter the code:
|
niceman |
Posted - 30 March 2009 : 14:52:02 I get this error:
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/forum/inc_last_x_topics.asp, line 253
quoS = instr(temp, " --------------------^ |
Carefree |
Posted - 30 March 2009 : 14:13:24 Yes. Save the following as "inc_last_x_topics.asp". Add the include wherever you want the topics displayed.
<%
'###############################################################################
'##
'## Snitz Forums 2000 v3.4.06
'##
'###############################################################################
'##
'## Copyright © 2000-06 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free. You can redistribute and/or modify it under the
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; either version 2 or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in
'## the scripts and in the HTML output. The "powered by" text/logo with a
'## link back to http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful but
'## WITHOUT ANY WARRANTY; without even an implied warranty of MERCHANTABILITY
'## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
'## for more details.
'##
'## You should have received a copy of the GNU General Public License along
'## with this program; if not, write to:
'##
'## Free Software Foundation, Inc.
'## 59 Temple Place, Suite 330
'## Boston, MA 02111-1307
'##
'## Support can be obtained from our support forums at:
'##
'## http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:
'##
'## manderson@snitz.com
'##
'###############################################################################
%><!-- ## START TOP MESSAGES -->
<%
on error resume next
'on error goto 0
' **********************************************************************************************
' Author: Bruno Alexandre <bruno.in.dk [at] gmail.com>
' Date: April 2007
' MOD: Get last 10 messages in the Forum
' Function:
' Displays vertically the Top messages in the Forum
' it turns user own message in a diferent color
' Versions:
' 1.0 Original version
' 1.1 26.11.07 Added more string to the translate part
' Added Rows and Columns in order to display
' 1.2 01.03.08 Added block preventing private messages to show
' 1.3 02.03.08 Updated with TopSQL() so it runs in mySQL as well (>4.x)
' **********************************************************************************************
' ***** >> change next values it at will
TABLE_TYPE_ROWS = 1 ' Number of rows ( Can't be <= 0 ) >> please read note
TABLE_TYPE_COLS = 5 ' Number of columns ( Can't be <= 0 ) >> please read note
TABLE_TYPE_TOP = TABLE_TYPE_ROWS * TABLE_TYPE_COLS
' NOTE: in order to mantain a reading layout, the SELECT TOP function is determinated by
' multipling Rows by Columns.
' SELECT TOP ( Rows x Columns ) ...
MAX_MESSAGE_LEN = 70 ' Display the first 70 characters
MAX_MESSAGE_BREAK_LEN = 40 ' If in thoose 70 charcarters there is no white space, add one
OWN_MESSAGE_COLOR = "#E6EFF7" ' Background color of message if it belongs to the user logged in
' **********************************************************************************************
' ***** >> change next values it at will
select case session.lcid
case 2070 ' PT-pt
strTop10TopMsg = "Últimas " & cStr(TABLE_TYPE_TOP) & " mensagens!"
strTop10MsgBottomLink = "Últimos tópicos activos"
strTop10MsgTopic = "Tópico"
strTop10MsgBy = "por"
strTop10MsgIn = "em"
strTop10Error = "TABLE_TYPE_ROWS e/ou TABLE_TYPE_COLS não são um valor numerico!"
case else ' All the others
strTop10TopMsg = "Last " & cStr(TABLE_TYPE_TOP) & " public topics!"
strTop10MsgBottomLink = "Active topics"
strTop10MsgTopic = "Topic"
strTop10MsgBy = "by"
strTop10MsgIn = "in"
strTop10Error = "TABLE_TYPE_ROWS and/or TABLE_TYPE_COLS are not a numeric value!"
end select
' **********************************************************************************************
' **********************************************************************************************
' D O N ' T C H A N G E A N Y T H I N G M O R E I F Y O U
' D O N ' T K N O W W H A T A R E Y O U D O I N G
' **********************************************************************************************
if not ( isNumeric(TABLE_TYPE_ROWS) and isNumeric(TABLE_TYPE_ROWS) ) then
response.write _
"<table cellspacing=""1"" cellpadding=""4"" style=""border: solid 1px #0E3A5C; width: 100%;"">" & vbNewLine & _
" <tr align=""center"">" & vbNewLine & _
" <td width=""100%""><b>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""White"">" & strTop10Error & "</font></b>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>"
response.flush()
response.end()
elseif TABLE_TYPE_ROWS <= 0 or TABLE_TYPE_ROWS <= 0 then
response.write _
"<table cellspacing=""1"" cellpadding=""4"" style=""border: solid 1px #0E3A5C; width: 100%;"">" & vbNewLine & _
" <tr align=""center"">" & vbNewLine & _
" <td width=""100%""><b>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""White"">" & strTop10Error & "</font></b>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>"
response.flush()
response.end()
end if
' ## Below sqlStr is for last x messages (including topics and replies)
' ## Added , f.FORUM_ID, f.F_SUBJECT to below sqlstr in order to enable forum subjects in table
'sqlstr = "SELECT " & _
' "a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME, f.FORUM_ID, f.F_SUBJECT " & _
' "FROM ( " & _
' "SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME " & _
' "FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR " & _
' "UNION ALL " & _
' "SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, r.REPLY_ID AS MSG_ID, r.R_MESSAGE as MSG, r.R_DATE as MSG_DATE, m.MEMBER_ID, m.M_NAME " & _
' "FROM (FORUM_TOPICS t INNER JOIN FORUM_REPLY r ON t.TOPIC_ID = r.TOPIC_ID) INNER JOIN FORUM_MEMBERS m ON r.R_AUTHOR = m.MEMBER_ID " & _
' ") a " & _
' "INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID " & _
' "WHERE f.F_PRIVATEFORUMS = 0 " & _
' "ORDER BY MSG_DATE DESC;"
' ## Below strSql is for last x topics
' ## Added , f.FORUM_ID, f.F_SUBJECT to below sqlstr in order to enable forum subjects in table
sqlstr = "SELECT " & _
"a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME, f.FORUM_ID, f.F_SUBJECT " & _
"FROM ( " & _
"SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME " & _
"FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR " & _
") a " & _
"INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID " & _
"WHERE f.F_PRIVATEFORUMS =0 " & _
"ORDER BY MSG_DATE DESC;"
Set objRec = Server.CreateObject ("ADODB.Recordset")
objRec.Open TopSQL(sqlstr, cStr(TABLE_TYPE_TOP)), My_Conn
response.write _
"<table cellspacing=""1"" cellpadding=""4"" border=""0"" width=""100%"" bgcolor=""" & strHeadCellColor & """ background=""" & strImageURL & strHeadCellBGImage & """>" & vbNewLine & _
" <tr valign=""top"">" & vbNewLine & _
" <td width=""100%"" align=""center""><b>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""White"">" & strTop10TopMsg & "</font></b>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""100%"" align=""center"" bgcolor=""" & strCategoryCellColor & """ background=""" & strImageURL & strCategoryCellBGImage & """>" & vbNewLine & _
" <table cellspacing=""3"" cellpadding=""0"" style=""border: 0px; width: 100%;"">" & vbNewLine
iMsg = 0
iRows = 1
iCols = 1
objRec.moveFirst()
while not objRec.EOF
iMsg = iMsg + 1
if iMsg mod 2 then
bColor = strAltForumCellColor
else
bcolor = strForumCellColor
end if
if trim(strDBNTUserName) = trim(objRec.fields("M_NAME")) then
bcolor = OWN_MESSAGE_COLOR
end if
if objRec("MSG_ID") = "" then
strT = "<img src=""Images/icon_folder_new_topic.gif"" alt="""" />"
else
strT = "<img src=""Images/icon_folder.gif"" alt="""" />"
end if
strIcone = " <a href=""topic.asp?whichpage=-1&TOPIC_ID=" & objRec.fields("TOPIC_ID") & "&REPLY_ID=" & objRec.fields("MSG_ID") & """>" & _
getCurrentIcon(strIconLastpost,fLang("L_Default075"),"align=""top""") & "</a>"
if iRows <= TABLE_TYPE_ROWS then
if iCols = 1 then
response.write "<tr>"
end if
if iCols <= TABLE_TYPE_COLS then
' Write Column
call writeMessage(objRec, sIcon, bgdColor)
end if
if iCols = TABLE_TYPE_COLS then
iRows = iRows + 1
iCols = 1
response.write "</tr>"
else
iCols = iCols + 1
end if
end if
objRec.moveNext()
wend
' **********************************************************************************************
' Table Footer
' **********************************************************************************************
response.write _
" </table>" & _
" </td>" & _
" </tr>" & _
"</table>"
objRec.close
set objRec = Nothing
' **********************************************************************************************
' Functions/Subs
' **********************************************************************************************
sub writeMessage(objRec, sIcon, bgdColor)
tdw=100/table_type_cols
strtdw=cstr(tdw)&"%"
response.write _
" <td width=""" & strtdw & """ align=""center"" style=""border: 1px solid " & strHeadCellColor & "; background-color: " & bcolor & ";"">" & vbNewLine & _
" <table style=""border: 0px"" colspan="""& table_type_cols & """ cellspacing=""0"" cellpadding=""3"">" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td width=""" & strtdw & """ align=""left"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & _
" " & strT & " " & strTop10MsgBy & " <strong>" & vbNewLine & _
" <a href=""pop_profile.asp?mode=display&id=" & objRec.fields("MEMBER_ID") & """>" & objRec.fields("M_NAME") & "</a>" & vbNewLine & _
" </strong></font>" & _
" <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><br />" & strTop10MsgIn & " " & _
FormatDateTime(StrToDate(objRec.fields("MSG_DATE")), 2) & " " & FormatDateTime(StrToDate(objRec.fields("MSG_DATE")), 4) & "" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""" & strtdw & """ align=""left"" valign=""middle"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Forum: " & objRec.fields("F_SUBJECT") & "<br>" & _
strTop10MsgTopic & ": <u>" & vbNewLine & _
" <a href=""topic.asp?TOPIC_ID=" & objRec.fields("TOPIC_ID") & """>" & objRec.fields("T_SUBJECT") & "</a>" & vbNewLine & _
" </u></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""" & strtdw & """ align=""left"" valign=""middle"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>" & writeSubject(objRec.fields("MSG"), strIcone) & "</font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine
end sub
function writeSubject( subj, icone )
temp = replace(subj , "<", "[")
temp = replace(temp , ">", "]")
if instr(temp, "[") >= 0 then
quoS = instr(temp, "quote: ")
quoF = instr(temp, "
")
if quoF > 0 then
temp = Left(temp, quoS-1) & " " & Mid(temp, quoF + 8, Len(temp)-quoF+8)
end if
while instr(temp, "]") > 0 and instr(temp, "]") < MAX_MESSAGE_LEN + 10
posS = instr(temp, "[")
posF = instr(temp, "]")
temp = Left(temp, posS - 1) & " " & Mid(temp, posF + 1, Len(temp)-posF)
wend
end if
if Len(temp) > MAX_MESSAGE_LEN then
writeSubject = Left(temp, MAX_MESSAGE_LEN) & "..." & icone
if instr(writeSubject, " ") = 1 then
' no white space found... break it!
writeSubject = Left(writeSubject, MAX_MESSAGE_BREAK_LEN) & " " & right(writeSubject, len(writeSubject) - MAX_MESSAGE_BREAK_LEN)
end if
else
writeSubject = temp & icone
end if
temp = ""
end function
%><!-- ## END TOP MESSAGES -->
|
|
|