PDA

View Full Version : Linking to the very last post in a thread


gopherhockey
09-10-2008, 05:03 PM
I need to be able to link to the last post in a thread. Not the last unread post, but the last item posted... the link needs to work regardless of how a user has their post order sorted, or if the user is not logged in.

Currently I use something like showthread.php?t=9180#post3107513

where post = larger number than the number of posts in a thread.

However, this link goes to the first post for some users and non-logged in users.

This is a link from a non php page. If there is a way to do it via php I am willing.

THanks.

Lynne
09-10-2008, 05:13 PM
Didn't you already post this? I know I've seen it before and even read a discussion about it just today or yesterday.

gopherhockey
09-10-2008, 05:15 PM
Didn't you already post this? I know I've seen it before and even read a discussion about it just today or yesterday.

I posted this question on vbulletin.com but have not gotten an answer so I thought to try here. So far nobody has come up with the answer...

If someone else posted this I apologize but I haven't been able to find the answer in all my searches thus far.

I see for forums (forumdisplay.php) you have sorting like &sort=lastpost &order=desc & daysprune= etc. Would be nice to know what options there are for showthread.php

Thanks.

Lynne
09-10-2008, 05:17 PM
I don't know that there is a static way of linking to the last thread. I think you have to use some variables in the link. Don't you do a query to grab the thread id? In the thread table is also the column "lastpost". Why can't you grab that at the same time you get the threadids?

gopherhockey
09-10-2008, 05:20 PM
I don't know that there is a static way of linking to the last thread. I think you have to use some variables in the link. Don't you do a query to grab the thread id? In the thread table is also the column "lastpost". Why can't you grab that at the same time you get the threadids?

I was afraid of that. I may have to add php code to the page and then try detect if a person is logged in or not, sending them a different way if they are not or depending on how they have their sort order.

At that point its not really worth it. Hmmm....

--------------- Added 10 Sep 2008 at 18:44 ---------------



Currently I use something like showthread.php?t=9180#post3107513



I tried showthread.php?t=9180&goto=newpost

THis might be working.

Opserty
09-10-2008, 07:52 PM
In the postbit_wrapper template try adding the bit in green:

<!-- post #$post[postid] -->
<if condition="$post['islastshown']"><a id="lastpostbit" name="lastpostbit"></a></if>
<if condition="$show['spacer']">
$spacer_open
<div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
<if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>
</if>

$postbit

<if condition="$show['spacer']">
</div>
$spacer_close
</if>
<!-- / post #$post[postid] -->
Then try the URL like:
showthread.php?t=9180#lastpostbitHaven't tested it but it should work.

Lynne
09-10-2008, 09:08 PM
I like how you think outside the lines, Opserty!

gopherhockey
09-12-2008, 11:40 AM
In the postbit_wrapper template try adding the bit in green:

<!-- post #$post[postid] -->
<if condition="$post['islastshown']"><a id="lastpostbit" name="lastpostbit"></a></if>
<if condition="$show['spacer']">
$spacer_open
<div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
<if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>
</if>

$postbit

<if condition="$show['spacer']">
</div>
$spacer_close
</if>
<!-- / post #$post[postid] -->
Then try the URL like:
showthread.php?t=9180#lastpostbitHaven't tested it but it should work.

Good thinking. What this seems to do is send a person to the last post on a page... in other words, if you have it set to oldest post first you are sent to the 15th post in the thread (must have it set to show 15 posts per page).

Is there a way to also get it to jump to the last page, then the last post?

Another possibility - is there a way to force a sort order based on a thread?

Opserty
09-12-2008, 12:31 PM
Oh sorry I misunderstood your question. :o

gopherhockey
09-12-2008, 02:03 PM
Oh sorry I misunderstood your question. :o

Well, I was still able to use your suggestion.

What I did was edited the first post in the threads in question. I put a notice that they were looking at an old post and inserted a link with page=99999#lastpostbit which shoots them to the last post.

I wish there was a better way but for now this might do.

Note: in case anyone is curious, what we have are threads where people post up trail conditions for mountain bike trails we have in the area. Then we have a page that lists all our trails with links to the most recent trail condition. Eventually we'd like to get fancy and have a page that could pull that information in, or build a better trail conditions sytem... but for now this lets us update it in one place and hope people are able to get to the latest information quickly. The whole sort order thing just got in our way, unfortunately.