Author |
Topic |
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 09 March 2006 : 06:15:12
|
It doesn't look like it's going to be possible to grab the last edited post using the existing query But I have made a couple of small changes to remove the unnecessary duplication of a couple of lines and to include a check to see if the value of the REPLY_ID variable passed through the querystring is numeric:if mypage=-1 then
strSql="SELECT REPLY_ID FROM "&strActivePrefix&"REPLY WHERE TOPIC_ID="&Topic_ID
if AdminAllowed=0 then
strSql=strSql&" AND (R_STATUS<"
if Moderation="Y" then strSql=strSql&"2" else strSql=strSql&"3"
strSql=strSql&" OR R_AUTHOR="&MemberID&")"
end if
strSql=strSql&" ORDER BY R_DATE ASC"
set rsReplies=server.createobject("ADODB.Recordset")
rsReplies.open strSql,my_Conn,adOpenStatic,adLockReadOnly,adCmdText
if not rsReplies.eof then
arrReplyData=rsReplies.getrows(adGetRowsRest)
iReplyCount=ubound(arrReplyData,2)
Reply_ID=trim(chkString(request.querystring("REPLY_ID"),"sqlstring"))
if len(Reply_ID)>0 and isnumeric(Reply_ID) then
LastPostReplyID=clng(Reply_ID)
for iReply=0 to iReplyCount
intReplyID=arrReplyData(0,iReply)
if LastPostReplyID=intReplyID then
intPageNumber=((iReply+1)\strPageSize)
exit for
end if
next
else
LastPostReplyID=clng(arrReplyData(0,iReplyCount))
intPageNumber=((iReplyCount+1)\strPageSize)
end if
if intPageNumber>clng(intPageNumber) then intPageNumber=clng(intPageNumber)+1
strwhichpage="whichpage="&intPageNumber&"&"
else
strWhichpage=""
end if
rsReplies.close
set rsReplies=nothing
my_Conn.close
set my_Conn=nothing
response.redirect "topic.asp?"&ArchiveLink&strwhichpage&"TOPIC_ID="&Topic_ID&SearchLink&"&#"&LastPostReplyID
response.end
end if < |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 09 March 2006 06:56:04 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 06:26:04
|
I get an error on this line of that last code: response.redirect "topic.asp?"&ArchiveLink&strwhichpage&"TOPIC_ID="&Topic_ID&SearchLink"#"&LastPostReplyID
Kompileringsfel i Microsoft VBScript fel '800a0401'
**** på programsats förväntas.
/topic.asp, line 350
response.redirect "topic.asp?"&ArchiveLink&strwhichpage&"TOPIC_ID="&Topic_ID&SearchLink"#"&LastPostReplyID
< |
/Tribaliztic - www.gotlandrace.se -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 06:29:48
|
LOL!! the word "end" in swedish is causing trouble with the badword filter =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 09 March 2006 : 06:45:24
|
Well, for starters, the bloody & went for a walk again, thanks to the forum filtering out &#.
Secondly, can you translate that error into English for us?
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 06:52:37
|
I suppose this is the correct translation:
Microsoft VBScript compilation error '800a0401' Expected end of statement
Where should I put the & ? =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 09 March 2006 : 06:57:42
|
Another & went walkabout in Rui's last posting of the code which I've added back in; just copy the updated redirect line from my last posting of it and all should be well.
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 07:03:35
|
ah, there you go =) No errors! But I see no link even though the option is selected in admin options. Where should it be located on the topic.asp page? =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 09 March 2006 : 07:17:14
|
It shouldn't be; if you read through this topic, you'll see that this is just a modification to the existing script that will allow you to jump to the last posted reply in a topic with th need to pass the REPLY_ID through the querystring.
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 07:21:08
|
Ah, that's right.. I saw that yesterday! My day haven't been that good to me so far =)
But isn't there a button also? < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 09 March 2006 : 07:22:25
|
No - what button?
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 08:08:23
|
A button where you can jump to the last post after opening the thread in topic.asp =) In admin options, under Feature Configuration I have a on/off-switch for "Show Jump To Last Post Link"... < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 09 March 2006 : 08:15:05
|
There is no such button on topic.asp, unless you have it modded in, and this modification does not add one.
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 09 March 2006 : 08:27:52
|
hehe, I'm using SHN version. Maybe it's from there. I thought it was basecode. Now when that is cleared you can take a look at my latest thread ;) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 13 September 2006 : 12:18:55
|
Here's the final version of this code that was included in Snitz v3.4.06, released today:if mypage=-1 then
strSql="SELECT REPLY_ID FROM "&strActivePrefix&"REPLY WHERE TOPIC_ID="&Topic_ID
if AdminAllowed=0 then
strSql=strSql&" AND (R_STATUS<"
if Moderation="Y" then strSql=strSql&"2" else strSql=strSql&"3"
strSql=strSql&" OR R_AUTHOR="&MemberID&")"
end if
strSql=strSql&" ORDER BY R_DATE ASC"
set rsReplies=server.createobject("ADODB.Recordset")
if strDBType="mysql" then rsReplies.open strSql,my_Conn,adOpenForwardOnly,adLockReadOnly,adCmdText else rsReplies.open strSql,my_Conn,adOpenStatic,adLockReadOnly,adCmdText
if not rsReplies.eof then
arrReplyData=rsReplies.getrows(adGetRowsRest)
iReplyCount=ubound(arrReplyData,2)
Reply_ID=trim(chkString(request.querystring("REPLY_ID"),"sqlstring"))
if len(Reply_ID)>0 and isnumeric(Reply_ID) then
LastPostReplyID=clng(Reply_ID)
for iReply=0 to iReplyCount
intReplyID=arrReplyData(0,iReply)
if LastPostReplyID=intReplyID then
intPageNumber=((iReply+1)/strPageSize)
exit for
end if
next
else
LastPostReplyID=clng(arrReplyData(0,iReplyCount))
intPageNumber=((iReplyCount+1)/strPageSize)
end if
if intPageNumber>clng(intPageNumber) then intPageNumber=clng(intPageNumber)+1
strwhichpage="whichpage="&intPageNumber&"&"
else
strWhichpage=""
end if
rsReplies.close
set rsReplies=nothing
my_Conn.close
set my_Conn=nothing
response.redirect "topic.asp?"&ArchiveLink&strwhichpage&"TOPIC_ID="&Topic_ID&SearchLink&"&#"&LastPostReplyID
response.end
end if < |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
Topic |
|