by Guest Tue 9 May - 18:25
In your index_body template, add this script anywhere:
- Code:
$(function(){
var totalposts='{TOTAL_POSTS}'.match(/\d+/);
var totalmembers='{TOTAL_USERS}'.match(/\d+/);
var lastuserurl='{NEWEST_USER}'.match(/\/u\d+/);
var lastusername='{NEWEST_USER}'.split("strong")[2].match(/[^><\/]/g).join("");
var totalon='{TOTAL_USERS_ONLINE}'.match(/>\d+\</).join("").match(/\d+/).join("");
var onregistred='{TOTAL_USERS_ONLINE}'.match(/\d+\ Registered/).join("").match(/\d+/).join("");
var onvisitors='{TOTAL_USERS_ONLINE}'.match(/\d+\ Guest/).join("").match(/\d+/).join("");
var onhidden='{TOTAL_USERS_ONLINE}'.match(/\d+\ Hidden/).join("").match(/\d+/).join("");
var recordonline='{RECORD_USERS}'.match(/>\d+\</).join("").match(/\d+/).join("");
var userliston='{LOGGED_IN_USER_LIST}'.split("Registered Users: ")[1];
})
You will now be able to use the following js variables:
totalposts-Total number of posts on your forum
totalmembers-Total number of members on your forum
lastuserurl-Link to the last registered user's profile
lastusername-Name of the last registered user
totalon-Number of users online now(Registered+Hidden+Visitors)
onregistered-Number of registered users online now
onvisitors-Number of visitors online now
onhidden-Number of hidden users online now
recordonline-Most users online at the same moment
userliston-The list of online users
How to use
Let's say that the element you want to contain the number of posts has the id
#posts. Than to display the total number of posts there, you would have to add this code after
in the code above:
- Code:
$("#posts").html(totalposts)