Discovery Gaming Community

Full Version: Link to specific post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I might not have found it yet, if that is the case I apologize.

The feature I am refering to is one I have seen on many other forums (vB, phpBB3, and SMF at least) and I can't imagine that it would be particularly difficult to provide here either.

The post number in the upper right of each post now links to a script that displays a link to that post in a dialogue box. It does not seem particularly useful since it only links to the page of the topic that the post is on, not the specific post in question. It also seems a bit erratic in the link it provides, occasionally it includes extraneous querystring arguments (such as session ID).

The solution I have been using is using the "st" parameter to put the post I am linking to at the top of the page. For example, "st=167" puts post #168 at the top of the page. This works fine though it doesn't explicitly point out the post in question and could still leave some uncertainty as to which post really is being linked to. It also requires some rudimentary technical understanding. It's little more than a half-useful patch.

I can think of two ways to implement linking to specific posts. The first is simple but perhaps not as useful as the second.

The simple implementation is to put anchors at the top of each post (simple template change) and change the top-right post number link to that anchor. (I believe this is the way phpBB3 does it.)

Each post begins with
Code:
<!--Begin Msg Number 12345-->
&nbsp;&nbsp;<table cellspacing="1">
&nbsp;&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td colspan="2" valign="middle" class="subtitle">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!-- POSTED DATE DIV -->
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float: left;"> <span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='style_images/deepblue[1/to_post_off.gif' alt='post' border='0' style='padding-bottom:2px' />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mon Da Year, Ti:me Pamela</span> </div>
This is likely generated in a loop in an iPB template. Adding a line of HTML with the msg number variable would be trivial.

The generated HTML should look something like this:
Code:
<!--Begin Msg Number 12345-->
&nbsp;&nbsp;<table cellspacing="1">
&nbsp;&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td colspan="2" valign="middle" class="subtitle">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!-- POSTED DATE DIV -->
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float: left;"> <span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='style_images/deepblue[1/to_post_off.gif' alt='post' border='0' style='padding-bottom:2px' />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a name="#msg12345">[/color]Mon Da Year, Ti:me Pamela</a></span> </div>

And the link_to_post function in ipb_topic.js should be changed to:
Code:
/*--------------------------------------------*/
// Link to a post
/*--------------------------------------------*/

function link_to_post(pid)
{
&nbsp;&nbsp;&nbsp;&nbsp;temp = prompt( ipb_lang_tt_prompt, ipb_var_base_url + "showtopic=" + ipb_input_t + "&view=findpost&p=" + pid + "#msg" + pid);
&nbsp;&nbsp;&nbsp;&nbsp;return false;
}


The more complicated implementation might require adding quite a few lines of PHP code (or a new page), and a new template. It would end with a link to a page that has the specific post alone on a page with a link to the topic it is part of. I don't know enough to say more than that. (I believe this is the way vB does it.)



Maybe worth doing?
It is already implemented, however it does not work perfectly.

The "Blue Solution" and "Deep Blue" forum skins differ in the anchor names, so if you make a link to a post, it won't work for everyone.

Example:

The link you get from the JavaScript linking function:

http://discoverygc.com/forums/index.php?s=...st&p=485046

This is what it gets transformed to:

http://discoverygc.com/forums/index.php?sh...mp;#entry485046
the #entry485046 anchor works in "Blue Solution" but does not work in Deep Blue.

For Deep Blue, you have to change it to #post-485046

making the "Deep Blue" link look like this:
http://discoverygc.com/forums/index.php?sh...mp;#post-485046

I simply looked into the source code and got it from there.


Now if this could be unified, it would help a lot.
I looked through the HTML source in Deep Blue, and I can't find any named anchors. Am I blind?

The Deep Blue link_to_post has never worked for me, and never gives a link to a named anchor.

No matter, it wouldn't be useful if it isn't standardized, as you said.

Standardize it.