vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   $totalposts coding! (https://vborg.vbsupport.ru/showthread.php?t=154007)

mpadc 08-01-2007 03:02 PM

$totalposts coding!
 
Hi All

Dont know if anyone can help me what PHP code would i use to say countdown to x amount of posts

say you are reaching 1 million posts

you want to subtract this figure to $totalposts

any idea how one would code this?!?!?

Thanks

StrifeX 08-01-2007 03:05 PM

I'm a bit confused... Are you trying to make a variable that shows the total amount of forum posts on the forumhome? If so, search these forums for global variables (i remember finding one by Ziki).

mpadc 08-01-2007 03:07 PM

Nah Basically trying to do a countdown

our forum is approaching 2million posts

so on forum home i want to write text like

"Number of posts till 2 million - (shows the figure here)

so im thinking along the lines of $totalposts which is the variable for showing how many posts a forum has at the moment and get the figure and subtract it by 2million :)

hoep tha tmakes sense!

Kirk Y 08-01-2007 06:23 PM

Create a new plugin at hook location "forumhome_complete" with the following:
Code:

$remaining = 2000000 - $totalposts;
Now place $remaining wherever you'd like the remaining posts displayed on the FORUMHOME template.

ie: There are $remaining posts remaining to our goal of 2,000,000.

Dismounted 08-02-2007 10:31 AM

$totalposts is formatted, so use this instead of Kirk's code.
PHP Code:

$remaining 2000000 str_replace(','''$totalposts); 


King Kovifor 08-02-2007 10:34 PM

Quote:

Originally Posted by Dismounted (Post 1307929)
$totalposts is formatted, so use this instead of Kirk's code.
PHP Code:

$remaining 2000000 str_replace(','''$totalposts); 


I almost just disputed that str_replace saying you didn't define anything. I'm retarded.

Marco van Herwaarden 08-03-2007 07:59 AM

..also the seperator might not be a comma. It will depend on how your numbers are formatted.

Ski-Whiz 09-03-2007 12:03 PM

With this, is there a way to put the comma back in?? (using Dismounted method)

My numbers are being outputted as 100000 vice 100,000

Opserty 09-03-2007 12:05 PM

http://members.vbulletin.com/api/vBu..._number_format

So something like:

PHP Code:

$formattedtp vb_number_format($totalposts); 


Ski-Whiz 09-03-2007 12:15 PM

But how would that format the output of

Code:

$remaining = 2000000 - str_replace(',', '', $totalposts);
I see where I can change the format of the total posts, but when using that count down code, it seems to strip the thousand separator..

ok I got it..

I just had to add another line..

So I used two $remaining1 and remaining....

Opserty 09-03-2007 01:13 PM

PHP Code:

$remaining 2000000 str_replace(','''$totalposts);
$remaining vb_number_format($remaining); 


Dismounted 09-04-2007 10:37 AM

PHP Code:

$remaining vb_number_format(2000000 str_replace(','''$totalposts)); 



All times are GMT. The time now is 08:06 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.01193 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
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)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