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)
 Jump to Last Post Permalink
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 5

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 21 September 2005 :  13:05:43  Show Profile  Reply with Quote
After some recent discussions about it, I've been working on modifying the jump to last post feature so it does not need to pass the REPLY_ID through the querystring, effectively allowing you to create permanent links that will always take you to the latest post in a topic. Here's what I have so far:
if mypage=-1 then
	strSql1="SELECT REPLY_ID"
	strSql2=" FROM "&strActivePrefix&"REPLY "
	strSql3=" WHERE TOPIC_ID="&Topic_ID
	if AdminAllowed=0 then
		strSql3=strSql3&" AND (R_STATUS<"
		if Moderation="Y" then strSql3=strSql3&"2" else strSql3=strSql3&"3"
		strSql3=strSql3&" OR R_AUTHOR="&MemberID&")"
	end if
	strSql4=" ORDER BY R_DATE ASC"
	set rsReplies=server.createobject("ADODB.Recordset")
	if strDBType="mysql" then
		rsReplies.open strSql1&strSql2&strSql3&strSql4,my_Conn,adOpenStatic,adLockReadOnly,adCmdText
		if rsReplies.eof then
			iReplyCount=-1
			strwhichpage=""
		else
			arrReplyData=rsReplies.getrows(adGetRowsRest)
			iReplyCount=ubound(arrReplyData,2)
			if len(request.querystring("REPLY_ID"))>0 then LastPostReplyID=clng(request.querystring("REPLY_ID")) else LastPostReplyID=cLng(arrReplyData(0,iReplyCount))
		end if
		if iReplyCount>-1 then
			for iReply=0 to iReplyCount
				intReplyID=arrReplyData(0,iReply)
				if LastPostReplyID=intReplyID then
					intPageNumber=((iReply+1)/strPageSize)
					if intPageNumber>clng(intPageNumber) then intPageNumber=clng(intPageNumber)+1
					strwhichpage="whichpage="&intPageNumber&"&"
					exit for
				end if
			next
		end if
	else
		rsReplies.cachesize=strPageSize
		rsReplies.pagesize=strPageSize
		rsReplies.open strSql1&strSql2&strSql3&strSql4,my_Conn,adOpenStatic,,adCmdText
		if len(request.querystring("REPLY_ID"))>0 then
			LastPostReplyID=clng(request.querystring("REPLY_ID"))
		else
			rsReplies.movelast
			LastPostReplyID=cLng(rsReplies("REPLY_ID"))
			rsReplies.movefirst
		end if
		rsReplies.find="REPLY_ID="&LastPostReplyID&""
		if not (rsReplies.eof or rsReplies.bof) then
			if rsReplies.absolutepage>1 then strwhichpage="whichpage="&rsReplies.absolutepage&"&"
		else
			strwhichpage = ""
		end if
	end if
	rsReplies.close
	set rsReplies=nothing
	my_Conn.close
	set my_Conn=nothing
	response.redirect("topic.asp?"&strwhichpage&"TOPIC_ID="&Topic_ID&"#"&LastPostReplyID&"")
	response.end
end if
That replaces the if statement beginning on line 202 of a fresh, v3.4.05 topic.asp. Note that I haven't tested this yet mainly because I don't have a clean Snitz that I can test it on but also because I've already encountered a problem in that the code above will always take you to the last actual reply to a topic without taking into account any replies that may have been edited after the last actual reply. I'm about to switch over to me other job for the evening but wanted to post this here first so's ye could see where I'm going with it and maybe offer some insights as to how to get around the problem I mentioned.

<

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 22 September 2005 09:05:28

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  06:54:43  Show Profile  Reply with Quote
Actually, thinking about it las night, would it really be that big a deal if this script redirected you to the last actual reply in a topic rather than the last edited reply? The main purpose for this script is for external links, which people unfamiliar with Snitz would be expecting to take them to the last actual post, and subscription mails which will only get sent out upon a new post.

All I need now is someone with a base install to test the above for me

<

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.”
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  08:24:14  Show Profile  Reply with Quote
i can test it ..but i haven't a fresh or new topic.asp<

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)


Edited by - Riccardo on 22 September 2005 08:26:32
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  08:25:55  Show Profile  Reply with Quote
Cool, cheers, man Be sure to back up your topic.asp file first, of course.

<

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.”
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  08:35:09  Show Profile  Reply with Quote
ok tested..but i don't see big differences from the regular work of topic.asp
could you explain me better the purpose of that code?<

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)

Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  08:48:10  Show Profile  Reply with Quote
Instead of linking to the last post of a topic using topic.asp?TOPIC_ID=x&whichpage=-1&REPLY_ID=y which will bring you to a specified reply (y), you can now do so using topic.asp?TOPIC_ID=x&whichpage=-1 which will always bring you to the actual last reply made in a topic.

<

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.”
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  08:52:42  Show Profile  Reply with Quote
so you save time for this operation now?
anyway the code work perfectly. Tested with reply and notifications..<

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)

Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  08:53:54  Show Profile  Reply with Quote
Got a link 'til I have a look?

<edit> By the way, what database did you test it on? </edit>

<

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 22 September 2005 08:56:26
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  08:55:49  Show Profile  Reply with Quote
yes you can..it a test forum in italian. the firts row is black 'cause i was testing a css style.

you find it here..
links removed by ruirib at user's request
Database? ACCESS<

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)


Edited by - Riccardo on 22 September 2005 09:00:08
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  09:06:14  Show Profile  Reply with Quote
D'oh! It's actually linking to the first reply. I've made some changes to me code above, in green, which should fix that.

<

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.”
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  09:13:54  Show Profile  Reply with Quote
i've modified..still the same result?
tell me 'cause i don't see differences.. :(<

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)

Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  09:16:30  Show Profile  Reply with Quote
It's working fine for me now on your test forum

<

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.”
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  09:23:13  Show Profile  Reply with Quote
good..when i'll understand all differences i'll be graduated in Snitz forum testing.. <

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)

Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 22 September 2005 :  09:25:29  Show Profile  Reply with Quote
I would think the main reason for passing it in the querystring, is to cut down on database calls. <

Support Snitz Forums
Go to Top of Page

Riccardo
New Member

86 Posts

Posted - 22 September 2005 :  09:28:05  Show Profile  Reply with Quote
ok great..if you want to test other codes i'm here (but later)! see you..<

http://www.peperonciniamoci.it
peppers and peppers and peppers (working on an international version)


Edited by - Riccardo on 22 September 2005 09:29:56
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 September 2005 :  09:29:59  Show Profile  Reply with Quote
quote:
Originally posted by Davio
I would think the main reason for passing it in the querystring, is to cut down on database calls.
Ay, but my script doesn't use any additional queries, it works off the existing query in topic.asp that's used to determine the page number.

<

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.”
Go to Top of Page
Page: of 5 Previous Topic Topic Next Topic  
Next 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.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07