Link to last post within a thread

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Link to last post within a thread

Post by Jim_Bo »

Hi,

Is it posible to link to a thread .. but have it go straight to the last post within the thread ..

something like:

<a href=\"/forum/showthread.php?t=$threadid&$postid\">$postername</a>

When I follow the link it takes me to the beginig of the thread even tho the $postid is pointing to the last post within the thread ..?

Thanks ..
Last edited by Jim_Bo on Wed Mar 30, 2005 3:29 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

using anchors, yes.

Anchors appear after the hash mark (#). Notice how when you post here and click to see your message there's a # followed by your post id. An anchor is the following:

Code: Select all

<a name=&quote;1234&quote;></a>
going to a page with that in the code, page.php#1234 will jump you to that location, or as close as the browser can get you to it.
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Post by Jim_Bo »

Hi,

Is the # put in manually like

<a href=\"/forum/showthread.php?t=$threadid?#$postid\">$postername</a>

<a href=\"/forum/showthread.php?t=$threadid&$postid#$postid\">$postername</a>

In which none of the above work ..

If i try:

<a href=\"/forum/showthread.php?p=$postid#$postid\">$postername</a>

it shows:

http://www.bla.com/forum/showthread.php?p=3156#3156

in the address bar .. but still takes me to the first post in the thread ..

Thanks
Last edited by Jim_Bo on Wed Mar 30, 2005 3:47 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

all posts have an anchor associated with them in the output.
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Post by Jim_Bo »

Hi,

I guess this is correct:

<a href=\"/forum/showthread.php?p=$postid#\">$postername</a>

?

It seems to work ..

Thanks
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Just before each post (or just the last post if you prefer), make sure that there is an anchor tag, such as what feyd suggested. without that tag, appending it to the url (page.php?post=12331#12331) wont do anything...
Post Reply