Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Forum stats on your site
Author Message
Splappy
Senior Member



Posts: 304
Joined: Oct 2008
Reputation: 5
Post: #1
Forum stats on your site
This tutorial will show you how to put your forum's stats on your site.

This code should be placed at the top of your page (before the <html>tag!):
PHP Code:
<?php
    $forumpath 
'path/to/your/forum';
    
chdir($forumpath);
    
define("IN_MYBB"1);
    require(
'./global.php');
    
chdir('path/to/your/site');
?>

Then, place this wherever you want your forum's stats to be shown (a sidebar maybe?):
PHP Code:
<?php
$lang
->load("global");
$stats $cache->read("stats");    
echo(
"<ul>");
echo(
"<li>Threads: {$stats['numthreads']}</li>");
echo(
"<li>Posts: {$stats['numposts']}</li>");
echo(
"<li>Members: {$stats['numusers']}</li>");
echo(
"</ul>");
?>
What it should look like (minus the "Forum Stats" heading):
[Image: forumstatsyn9.png]

lolwhut? | follow meh on twitter. NAW.
11-09-2008 12:36 PM
Nickman
Manager



Posts: 1,319
Joined: May 2008
Reputation: 30
Post: #2
RE: Forum stats on your site
Nice tutorial...did you learn how to do it yourself?
11-09-2008 03:44 PM


Splappy
Senior Member



Posts: 304
Joined: Oct 2008
Reputation: 5
Post: #3
RE: Forum stats on your site
(11-09-2008 03:44 PM)Nickman Wrote:  Nice tutorial...did you learn how to do it yourself?
Yeah...it took me a little while to figure it out with my limited PHP knowledge though :P

lolwhut? | follow meh on twitter. NAW.
11-10-2008 01:06 AM
Dalton
Tuts Team Lead



Posts: 894
Joined: Aug 2008
Reputation: 3
Post: #4
RE: Forum stats on your site
Awesome tut Amber! :)

11-11-2008 08:15 AM


tos3
Junior Member


Posts: 5
Joined: Nov 2008
Reputation: 0
Post: #5
RE: Forum stats on your site
very thx :)
11-15-2008 06:16 AM
Mc Cabe
Junior Member


Posts: 6
Joined: Nov 2008
Reputation: 0
Post: #6
RE: Forum stats on your site
Nice thanks Splappy :)
11-22-2008 09:56 PM


Rob1991
Member


Posts: 79
Joined: Nov 2008
Reputation: 0
Post: #7
RE: Forum stats on your site
oops, i didnt make a search before i posted a few mins ago, asking for exactly this!
However i asked if it could display

Posts:
Threads:
Members:
Newest Member:
Today's top poster:
Most popular forum:

Also i need to be able to do this for a website which is different to my mybb installation domain :o

can this be done :D?


Thanks so much :P

THis code just breaks my page :(

(This post was last modified: 11-22-2008 10:17 PM by Rob1991.)
11-22-2008 10:02 PM
2pac
Themes Team Lead



Posts: 291
Joined: May 2008
Reputation: 2
Post: #8
RE: Forum stats on your site
(11-22-2008 10:02 PM)Rob1991 Wrote:  oops, i didnt make a search before i posted a few mins ago, asking for exactly this!
However i asked if it could display

Posts:
Threads:
Members:
Newest Member:
Today's top poster:
Most popular forum:

Also i need to be able to do this for a website which is different to my mybb installation domain :o

can this be done :D?


Thanks so much :P

THis code just breaks my page :(

Like I said in the previous thread, make sure to check that you are changing the paths to that of your site.

In addition, you can use this on another domain, as long as they are all hosted on the same server.

http://completethoughts.info

A great general chat forum
11-23-2008 02:10 AM


Rob1991
Member


Posts: 79
Joined: Nov 2008
Reputation: 0
Post: #9
RE: Forum stats on your site
yeah they are but its still giving me a white page :(

I dont think its a problem with the code its something iv done when putting my website together to get the php to work in it, i dont have a clue what iv done to make my site :P its a complete mess xD

Il get back to you after iv had a chat with my host

(This post was last modified: 11-23-2008 04:07 AM by Rob1991.)
11-23-2008 04:03 AM
przemx
Junior Member


Posts: 5
Joined: Nov 2008
Reputation: 0
Post: #10
RE: Forum stats on your site
Thanks, i use it and it works
11-24-2008 07:06 AM


 




New to MyBBSource?Need Assistance?
  • Mark Forums Read
  • View Forum Staff
  • Looking for a MyBB Host?

  



Theme created by AK-47. Find more great themes and skins at K! Dezign