vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Comma in Post Counts Causing trouble (https://vborg.vbsupport.ru/showthread.php?t=54961)

Gutspiller 07-02-2003 07:57 PM

Comma in Post Counts Causing trouble
 
I'm hoping somebody can help me with a problem I'm having. In my forum I included a comma in post counts so that instead of saying a post count of 50000 it would show up as 50,000. The problem is, is that sometimes it will not show the last digit so a post count of 50,000 would show up as 50,00 Can somebody help me fix this probem? Here are the instructions I used to get the comma in the post counts:

Code:

In admin/functions.php:
Look for:


code: 
//highlight words for search engine

 



Add the following directly above it:

code: 
if($post[posts] >= 1000) {
  $left = floor($post[posts] / 1000);
  $right = $post[posts] % 1000;
  $post[posts] = "$left".","."$right";
}

Can somebody tell me if the intructions are messed up or what I can do to fix this problem? I will remove the comma before I put up with this problem any longer, but I was hoping somebody might be able to help me get the commas to work correctly.

Thanks in advance if somebody can help me.

filburt1 07-02-2003 08:07 PM

You can just use:
PHP Code:

$post['posts'] = number_format($post['posts']); 


Gutspiller 07-02-2003 08:21 PM

Quote:

Today at 03:07 PM filburt1 said this in Post #2
You can just use:
PHP Code:

$post['posts'] = number_format($post['posts']); 



So I would take out what I added to get the commas in, but where would I add the code that your talking about? :confused:

filburt1 07-02-2003 09:51 PM

number_format adds commas; I thought that was your question (but then again I'm really tired ;)).

Gutspiller 07-09-2003 03:27 AM

Quote:

07-02-03 at 04:51 PM filburt1 said this in Post #4
number_format adds commas; I thought that was your question (but then again I'm really tired ;)).

So how would I go about getting commas in the post count in user profiles?

noppid 07-09-2003 03:42 PM

As Filburt pointed out, it's a one line fix. Throw away your code and use his one line.

Gutspiller 07-09-2003 09:15 PM

Quote:

Today at 10:42 AM noppid said this in Post #6
As Filburt pointed out, it's a one line fix. Throw away your code and use his one line.

Unfortunantly it's not. I have that one line and I have many places where postcounts are as 56687 without a comma anywhere insight. :ermm:


All times are GMT. The time now is 10:05 AM.

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.00960 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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