vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Linking to the very last post in a thread (https://vborg.vbsupport.ru/showthread.php?t=190586)

gopherhockey 09-10-2008 05:03 PM

Linking to the very last post in a thread
 
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

Quote:

Originally Posted by Lynne (Post 1619215)
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

Quote:

Originally Posted by Lynne (Post 1619221)
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 ---------------

Quote:

Originally Posted by gopherhockey (Post 1619202)

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:
Code:

<!-- 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:
Code:

showthread.php?t=9180#lastpostbit
Haven'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

Quote:

Originally Posted by Opserty (Post 1619369)
In the postbit_wrapper template try adding the bit in green:
Code:

<!-- 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:
Code:

showthread.php?t=9180#lastpostbit
Haven'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

Quote:

Originally Posted by Opserty (Post 1620494)
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.


All times are GMT. The time now is 12:34 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02633 seconds
  • Memory Usage 1,742KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete