vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Post Counter & Direct Link (https://vborg.vbsupport.ru/showthread.php?t=22083)

bira 07-05-2001 10:00 PM

This is a small hack I have on my BB that I posted some 2 months ago in reply to a thread in the hacks request forum. Since then, a couple of people contacting me asking me this hack, so I'm posting it here in the release forum.

It numbers your posts in a thread - the first one has the number 1 written on it, the second 2 etc. This will accurately count the post number irrespective of the page you are on, and tt helps orientation on long threads (and our threads are long).

The post number on my BB is also a hyperlink, so people can copy the direct URL to that specific post.

Installation is simple:

INSTALLATION INSTRUCTIONS FOR VERSIONS BEFORE 2.0.3
scroll down for installation in version 2.0.3 and later

Open showthread.php

Find

PHP Code:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) { 

and ABOVE it put:

PHP Code:

$countposts = ($pagenumber-1)*$perpage


Find

PHP Code:

eval("\$postbits .= \"".gettemplate("postbit")."\";"); 

and ABOVE it put:

PHP Code:

$countposts $countposts+1

save and upload.

Edit template postbit and place the variable $countposts where you want the post # to show.

For example, place <smallfont>Post #$countposts</smallfont> somewhere at the bottom or <a href="showthread.php?postid=$post[postid]#post$post[postid]"><smallfont>$countposts</smallfont></a> if you want the numebr to also be a hyperlink directly to that post.

-------------------------------------------------------------------------

INSTALLATION INSTRUCTION FOR VERSIONS 2.0.3 AND UP

ok, how 'postbit' is parsed has changed since 2.0.3 so here's what you need to do to install this:

Quote:

Originally posted by freddie
If you want a one file hack for this than do this:

find in showthread.php:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {

Put this before it:

$postcount = ($pagenumber - 1 ) * $perpage;

Find in showthread.php:

$postbits .= getpostbit($post);

Put this before it:

$post[postcount] = ++$postcount;

Then put $post[postcount] in your postbit template.
save and upload.

Edit template postbit AND postbit_ignore and place the variable $countposts where you want the post # to show.

For example, place <smallfont>Post #$post[postcount]</smallfont> somewhere at the bottom or <a href="showthread.php?postid=$post[postid]#post$post[postid]"><smallfont>$post[postcount]</smallfont></a> if you want the numebr to also be a hyperlink directly to that post.

---------------------------------------

You can see it on my BB, on any of the threads (near the date/time of the post, to the right of the small folder icon). Example: http://www.atlasf1.com/bb/showthread...threadid=24656

Cheers,

Bira

TheDude 07-06-2001 08:48 AM

thanks
easy hack but the idea is quite interresting especially for very long threads
thanks again bira !!

ztsky 07-06-2001 09:56 AM

A useful hack,THANKS.:p

JJR512 07-06-2001 07:48 PM

Thank you, bira. A relatively simple, but incredibly useful hack. Sometimes it's the simple things in life that mean the most, ya know? ;)

Anyway, when I install hacks, I prefer to work from a text file saved locally. I think they're easier to work with, especially when copying things to put in the vB file. Also, if I have the hack instructions saved locally, I know I'll have it handy when I have to upgrade the board and reinstall all the hacks. That way, I don't have to go searching through this board to find everything that I can remember. :)

So I hope you don't mind, but I've taken the liberty of copying your instructions into a text file and attaching it to this message. This way people can download it and have it to work with permanently.

BluSmurf 07-06-2001 08:54 PM

great easy hack :D

JJR512 07-08-2001 02:23 AM

That's funny, I could have sworn I had attached that file as mentioned earlier...but here it is now.

dwh 07-08-2001 02:42 AM

Quote:

Originally posted by JJR512
That's funny, I could have sworn I had attached that file as mentioned earlier...but here it is now.
you did attach it but it didn't work and had an activex error and it happened again. Is this activex safe code? Anyone know what's going on?

JJR512 07-08-2001 03:04 AM

I don't understand how it could have an activex error. It's a plain text file, and all it includes is the text of bira's first post in this thread, plus I added a line to the effect that bira wrote it, and I also put in the URL to this thread. There's nothing in the file itself that needs to work, unless you mean the hack itself, which doesn't include any activex stuff that I see. :confused:

Oh...and if I did indeed attach it the first time, as I remember and as you admit, but it's not there now, then someone must have removed it. Does anyone think it may have been a good or nice idea to let me know about something like that? (My board was founded mainly on the principle that if somebody screws up or does something wrong, whether intentional or not, he/she will be informed of the problem and the solution, publically if possible, so hopefully the mistake will not occur again in the future, by either the original person, or by anybody else. My board was founded on this principle to provide an alternative for disgruntled members of another high-volume message board where threads and posts mysteriously disappeared and nobody knew why, or members were banned without knowing why, etc.)

dwh 07-08-2001 08:53 PM

It turns out the activex is on all posts for me. Maybe I remember it wrong and you didn't post the attachment? Anyways, by clicking save as i don't get the activex problem.

MarkB 07-09-2001 04:43 AM

Quote:

Originally posted by bira
...or <a href="showthread.php?postid=$post[postid]#post$post[postid]"><smallfont>$countposts</smallfont></a> if you want the numebr to also be a hyperlink directly to that post.

Shouldn't that be

<a href="showthread.php?threadid=$post[threadid]#post$post[postid]"><smallfont>$countposts</smallfont></a>


Otherwise it will try to link to a different post...? Forgive me if I'm wrong, I'm new at this :)

JJR512 08-01-2001 12:08 AM

I think this needs to be updated for 2.0.3...I couldn't find this code at all:
PHP Code:

eval("\$postbits .= \"".gettemplate("postbit")."\";"); 

I looked in my older showthread.php and found where this code is, and searched for some of the lines in its vicinity in the new showthread.php, but couldn't find any of them, either.

Please update this!

dwh 08-01-2001 04:38 AM

It's more complicated now, I'll try to be brief.

In showthread.php
after

Code:

$counter=0;
but before

Code:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {
add

Code:

$countposts = ($pagenumber-1)*$perpage;
about 8 lines down

BEFORE
Code:

  $postbits .= getpostbit($post);
add

Code:

  $countposts = $countposts+1;
Close showthread.php.

Open admin/functions.php

Find

Code:

function getpostbit($post) {
// sorts through all the stuff to return the postbit template

        // user
        global $bbuserinfo,$ignore;
        // showthread //added $countposts
        global $counter,$firstnew,$sigcache,$highlight,$postid,$forum;

Now add countposts variable to the end like so

Code:

function getpostbit($post) {
// sorts through all the stuff to return the postbit template

        // user
        global $bbuserinfo,$ignore;
        // showthread //added $countposts
        global $counter,$firstnew,$sigcache,$highlight,$postid,$forum,$countposts;

Done.

FWC 08-01-2001 05:59 AM

Quote:

It's more complicated now, I'll try to be brief.
It is more complicated now. But, your suggestion worked. Thanks, dwh!

dxb 08-01-2001 09:05 PM

thanks dwh you just made it so simple :) and it worked great

Sarge 08-04-2001 09:17 AM

Thanks
IT works great!
Sarge

Admin 08-05-2001 11:32 AM

For some reason, the first post in the thread is labeled 0.
I'm using v2.0.3, so I did what dwh said, and the code for the template is from bira.
Help?

dwh 08-05-2001 11:37 PM

not sure. do you have a url to look at?

Admin 08-06-2001 02:53 AM

Ok I fixed it, just put
PHP Code:

$countposts = (($pagenumber-1)*$perpage)+1

instead of
PHP Code:

$countposts = ($pagenumber-1)*$perpage

Good hack! :D

SirSteve 11-05-2001 07:39 PM

This working for vb 2.2.0 ?

FWC 11-05-2001 07:56 PM

Quote:

Originally posted by SirSteve
This working for vb 2.2.0 ?
Yep, it works fine in 2.2.0. I love this hack. I wish it was built in to vB. It's nice to know where you are in a thread.

bira 11-25-2001 10:38 AM

ok, how postbit is parsed has changed since 2.0.3 so here's what you need to do to install this:

Quote:

Originally posted by freddie
If you want a one file hack for this than do this:

find in showthread.php:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {

Put this before it:

$postcount = ($pagenumber - 1 ) * $perpage;

Find in showthread.php:

$postbits .= getpostbit($post);

Put this before it:

$post[postcount] = ++$postcount;

Then put $post[postcount] in your postbit template.

Admin 11-28-2001 04:35 PM

Installed here. :)

(as requested by FWC :D)

bira 11-28-2001 04:39 PM

yay!!! Thank you!

FWC 11-28-2001 07:08 PM

Quote:

Originally posted by FireFly
Installed here. :)

(as requested by FWC :D)

Thanks,. Firefly!! :D

Prezident 11-29-2001 12:06 AM

For those of us the REALLY SUCK with html, it was very hard to figure out how and where to get the link to show up where I wanted it, but I finally got it.

Forcing myself to learn something sure can be painful during the process.

Thanks for the hack. Very useful.

Meta 11-29-2001 08:36 AM

Easy installed ... thanks for the hack!

xug 12-02-2001 02:17 AM

What would be the code to place (post #1) in the right corner on the same line as the $post[icon] and $post[title], just like this forum ??

Thank you.

xug 12-02-2001 02:22 AM

Oops I found it ! :)

After the line :

<td bgcolor="$post[backcolor]" width="100%" valign="top">

I inserted this :

<table border="0" width="100%">
<tr>
<td width="79%">
<smallfont>$post[icon] <b>$post[title]
</td>
<td width="21%">
<smallfont>
<p align="right"><a href="showthread.php?postid=$post[postid]#post$post[postid]">Post #$countposts</a></td>
</tr>
</table>

Cool huh for a starter :)

Mohamed 12-02-2001 07:14 AM

nice hack and Easy installed :D


thanks

Crinos 12-02-2001 09:01 AM

A slightly different approach...

In postbit, After this:

Code:

<td bgcolor="$post[backcolor]" width="100%" valign="top">
replace this:

Code:

<smallfont>$post[icon] <b>$post[title]</b></smallfont>
With this:

Code:

<table border="0" width="100%">
<tr>
<td width="85%">
<smallfont>$post[icon] <b>$post[title] </b></smallfont>
</td>
<td width="15%" align="right">
<smallfont>
<a href="showthread.php?postid=$post[postid]#post$post[postid]">Post #$countposts</a></smallfont></td>
</tr>
</table>

Basically the same as Xug's but I used the cell alignment instead of a paragraph alignment :)

Lesane 12-07-2001 10:36 AM

Great Hack, works good here. Thnx Bira

Freddie Bingham 12-10-2001 02:48 AM

If you want a one file hack for this than do this:

find in showthread.php:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {

Put this before it:

$postcount = ($pagenumber - 1 ) * $perpage;

Find in showthread.php:

$postbits .= getpostbit($post);

Put this before it:

$post[postcount] = ++$postcount;

Then put $post[postcount] in your postbit template.

bira 12-10-2001 02:53 AM

Freddie, any chance you'll consider including this in v3? :D

Thanks for the shortcut

FWC 12-10-2001 02:55 AM

Will this be in vB 3, Freddie? I love this hack. :)

Freddie Bingham 12-10-2001 03:47 AM

I did right before I made my post ;) I don't know if it will be in the postbit template by default but the $post[postcount] variable is set.

FWC 12-10-2001 03:49 AM

Quote:

Originally posted by freddie
I did right before I made my post ;) I don't know if it will be in the postbit template by default but the $post[postcount] variable is set.
Cool! Thanks, Freddie. :)

Justice 12-10-2001 03:58 AM

just installed bira's hack and came in to say it works, and I see freddie's quicker method.

oh well, good job nonetheless

bira 12-10-2001 04:14 AM

Thanks Freddie!

Princeton 12-10-2001 07:46 PM

Great hack ... just installed it no problem.

Bedhead 12-11-2001 03:00 AM

Works like a charm.

Thanks for that buddy.


All times are GMT. The time now is 04:47 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.01729 seconds
  • Memory Usage 1,838KB
  • 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
  • (10)bbcode_code_printable
  • (7)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete