The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Posts, replys & Views "counts" without comma?
I need to remove the comma in order to send the variable in javascript and work the number to 1200> 1.2K. The problem is that javascript takes the comma as if it were sending 2 values and only works with numbers without a comma.
So what I need is to remove the comma before sending it to javascript. Example: 1,000 > 1000 1,000,000 > 1000000 PHP Code:
PHP Code:
thx |
#2
|
||||
|
||||
In your second script, try this:
HTML Code:
<script type="text/javascript"> var n = {vb:raw forum.threadcount}; n = n.replace(/\,/g, ''); n = parseInt(n, 10); document.write(fHcountHits(n)); </script> |
#3
|
||||
|
||||
Quote:
I have tried it from this method, but without results, it directly does not return anything and with the second script that publishes it returns 1 when it detects a comma. Any other solution ?. |
#4
|
||||
|
||||
You would be better off doing this server side (PHP), rather than client side (javascript). For example, you could define your function by using a plugin hooked at "forumhome_start" with the code:
PHP Code:
PHP Code:
|
#5
|
||||
|
||||
I removed my javascript, left the raw default and did this:
plugin 1: plugin 2: forumhome: Apparently it works, at least shows numbers, no counter exceeds 1000 so no wisdom really worked, but at the moment it shows the normal. forumdisplay = subforum?: Code:
Fatal error: Call to undefined function fHcountHits() in public_html/forum/includes/functions_forumlist.php(466) : eval()'d code on line 26 edit: If I move the plugin 1 to global_start, it works, but look how it responds: |
#6
|
||||
|
||||
In order to get the same kind of thing happening on the forumdisplay page, you need to create 2 new plugins...one hooked at "forumdisplay_start" to contain the fHcountHits() function, and another at "threadbit display" with the code:
PHP Code:
|
#7
|
||||
|
||||
hmm so?:
plugin1 - main plugin2 - hook1 plugin3 - hook2 now, forumhome error: Code:
Fatal error: Call to undefined function fHcountHits() in /public_html/forum/includes/functions_forumlist.php(466) : eval()'d code on line 26 edit: Sorry, I pass it to forumhome_start, also forumehome works and subforum stops working with the same error that the function is not declared. On the other hand, although this stated does not do what it has to do. |
#8
|
||||
|
||||
You need 4 plugins total...you are missing the function definition hooked at "forumhome_start"...
The function definition needs to be in 2 plugins. |
Благодарность от: | ||
RaYdeN.ADM |
#9
|
||||
|
||||
Quote:
Well, the plugins and hooks already work. Now what is wrong for "0G" to write and the "1,"00" > "1200" > "1.2K" ?.. That do not work even if the 4 plugins are working. |
#10
|
||||
|
||||
I would have to come to your site to sort it out...so if you want, PM the login credentials to a full admin account to me, and I will come by tomorrow and take a look. It is very late here.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|