vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Simple Request for Stats (https://vborg.vbsupport.ru/showthread.php?t=75729)

kerplunknet 02-04-2005 03:40 PM

Simple Request for Stats
 
I want to make a page that simply says:

Threads: XXXX
Posts: XXXX
Members: XXXX

'XXXX' being the actual variables. I've searched through this whole forum and found nothing like this. Please help. :)

N8 02-04-2005 08:19 PM

-Make a copy of index.php

-Rename it stats.php or whatever you want.

-find
Code:

eval('print_output("' . fetch_template('FORUMHOME') . '");');

-change FORUMHOME to STATS

-Create a custom template called STATS

Within that template, you can now use any of the codes that you can use on the FORUMHOME template. I'm not sure what the code is to disaplay posts/threads, I'm in the middle of switching webhosts. Just look around in forumhome and you will find it.

If you need it to be in a different dir than /forum or wherever you have your files stored, just open up config.php and includes/init.php and change all of the require("whatever.php"); to require ("home/yourSite/public_html/forum/whatever.php");



~Hope that helps ;)

kerplunknet 02-05-2005 03:57 PM

Thank you. :)

Andreas 02-05-2005 10:37 PM

@N8_115
That's overkill ...

Use this as stats.php
PHP Code:

<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''stats');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array('userstats');

// pre-cache templates used by all actions
$globaltemplates = array('STATS');

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$userstats unserialize($datastore['userstats']);
$stats $DB_site->query_first("SELECT SUM(replycount) AS posts, SUM(threadcount) AS threads FROM " TABLE_PREFIX "forum");

eval(
'print_output("' fetch_template('STATS') . '");');
?>

Then in template STATS you can use

Threads: $stats[threads]
Posts: $stats[posts]
Members: $userstats[numbermembers]

kerplunknet 02-07-2005 11:33 PM

KirbyDE: That doesn't work... blank page.

Do I have to change anything?

Andreas 02-08-2005 06:10 AM

Hmm, does work just fine for me.
Did you create the template STATS?

kerplunknet 02-08-2005 04:04 PM

Oh, it's probably because we have some extra coding for our site. I see. Nevermind. Thanks. ;)


All times are GMT. The time now is 08:04 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.01013 seconds
  • Memory Usage 1,729KB
  • 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
  • (1)bbcode_php_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