Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Current Version (Old)
 Paging Question
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

e3stone
Average Member

USA
885 Posts

Posted - 08 June 2001 :  08:52:50  Show Profile  Send e3stone an AOL message
I set anchors in topic.asp with this: <a name="<% =rs("reply_id") %>"></a> for each message, then I have a page that lists all the replies and have this link: <a href='link.asp?topic_id=" & rs("Topic_ID") & "#" & rs("reply_id") & "'>" , but the only problem I'm having is if the topic has more than one page then if I click on the link above that is suppose to point me to a certain message on the second page, it takes me to the top of page one. Looking at the code, I realize that I need something like Work Mule's 'jump to last post' feature:

Select Case request("jump")
Case "lastpost"
rs.absolutepage = maxpages
mypage = maxpages
Case "newpost"
with rs
if .recordcount <> 0 then
'set recordset filter
.filter = ("R_DATE > '" & lastDate & "'")
if .recordcount = 1 then
.movefirst
newrecpos = .absoluteposition
if ((newrecpos mod strPageSize) > 0) then
mypage = Int(Abs(newrecpos/strPageSize))+1
else
mypage = Int(Abs(newrecpos/strPageSize))
end if
end if
end if
'take out filter
.filter = ""
end with
rs.absolutepage = mypage
Case Else
rs.absolutepage = mypage
End Select

Does anyone know how I can jump to a specific reply based on the reply_id?

Thanks

<-- Eric -->


InsideWaco.com

work mule
Senior Member

USA
1358 Posts

Posted - 08 June 2001 :  11:32:08  Show Profile
Try this:

The link from link.asp would look like this:

respone.write("<a href='link.asp?topic_id=" & rs("Topic_ID") &_
"&reply_id=" & rs("reply_id") &_
"#" & rs("reply_id") & "'>")


(I broke up the line above using &_ so it fit within a decent window size here, change to suit your needs.)

Add this to the Select Statement that you referenced above:

Case "link"
with rs
if .recordcount <> 0 then
'set recordset filter
.filter = ("REPLY_ID > '" & request.querystring("reply_id") & "'")
if .recordcount = 1 then
.movefirst
newrecpos = .absoluteposition
if ((newrecpos mod strPageSize) > 0) then
mypage = Int(Abs(newrecpos/strPageSize))+1
else
mypage = Int(Abs(newrecpos/strPageSize))
end if
end if
end if
'take out filter
.filter = ""
end with
rs.absolutepage = mypage


Probably a better thing is to embed a Select Statement for the portion of setting the filter. That's the only thing that really changed between the two Case sections.

I think this latter idea is what I will do:


strJump = request("jump")

Select Case strJump
Case "lastpost"
rs.absolutepage = maxpages
mypage = maxpages
Case "newpost","link"
with rs
if .recordcount <> 0 then
'set recordset filter
Select Case strJump
Case "newpost"
.filter = ("R_DATE > '" & lastDate & "'")
Case "link"
.filter = ("REPLY_ID > '" & request.querystring("reply_id") & "'")
End Select
if .recordcount = 1 then
.movefirst
newrecpos = .absoluteposition
if ((newrecpos mod strPageSize) > 0) then
mypage = Int(Abs(newrecpos/strPageSize))+1
else
mypage = Int(Abs(newrecpos/strPageSize))
end if
end if
end if
'take out filter
.filter = ""
end with
rs.absolutepage = mypage
Case Else
rs.absolutepage = mypage
End Select


The Writer Community

"Do not go where the path may lead, go instead where there is no path and leave a trail."

-Ralph Waldo Emerson

Edited by - work mule on 08 June 2001 18:22:43
Go to Top of Page

e3stone
Average Member

USA
885 Posts

Posted - 08 June 2001 :  17:08:00  Show Profile  Send e3stone an AOL message
I don't really understand this

Firstly, I don't understand what link.asp does. On the "jump to new post" it is linked directly to topic.asp and doesn't go through link.asp Why would this be any different? In Topic.asp I'm casing for "link", but if it goes through link.asp, how is that querystring passed to topic.asp?

<-- Eric -->


InsideWaco.com
Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 08 June 2001 :  18:22:22  Show Profile
Well, I'm not sure why you would be going through link.asp with the reply id anyways? So maybe we just forget about link.asp for a couple seconds.

When you have a topic with many pages and you want to jump to a specific reply, you have to find out what page that would appear on. That page of replies has to be retrieved by the webserver. If that reply isn't on the page sent to the browser, then the anchor tag can't do anything. Does that make sense?

Well put it this way...change any case of "link" to "reply" in that case statement and when the incoming url looks something like this, then above code should display the proper page and your anchor should work.

topic.asp?topic_id=1097&jump=reply&reply_id=52084




The Writer Community

"Do not go where the path may lead, go instead where there is no path and leave a trail."

-Ralph Waldo Emerson
Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 19 June 2001 :  18:36:40  Show Profile
This is a revision of what I posted above!!:

The link from any file could/would look like this:


respone.write("<a href='topic.asp?jump=xxxx" &_
"&topic_id=" & rs("Topic_ID") &_
"&reply_id=" & rs("reply_id") &_
"#" & rs("reply_id") & "'>")


Or in non-asp format, look something like this:

topic.asp?jump=reply&topic_id=50&reply_id=23#23

The above link doesn't take into account category id, forum id, etc...this is just for discussion purposes for now.



strJump = request("jump")

Select Case strJump
Case "lastpost"
rs.absolutepage = maxpages
mypage = maxpages
Case "newpost","link","reply"
with rs
if .recordcount <> 0 then
'set recordset filter
Select Case strJump
Case "newpost"
.filter = ("R_DATE > '" & lastDate & "'")
Case "link","reply"
.filter = ("REPLY_ID = '" & request.querystring("reply_id") & "'")
End Select
if .recordcount > 0 then
.movefirst
newrecpos = .absoluteposition
if ((newrecpos mod strPageSize) > 0) then
mypage = Int(Abs(newrecpos/strPageSize))+1
else
mypage = Int(Abs(newrecpos/strPageSize))
end if
end if
end if
'take out filter
.filter = ""
end with
rs.absolutepage = mypage
Case Else
rs.absolutepage = mypage
End Select



The Writer Community

"Do not go where the path may lead, go instead where there is no path and leave a trail."

-Ralph Waldo Emerson
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.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07