Page 1 of 1

TopStats on external page

Posted: 16 Oct 2012, 18:21
by GROMOVNIK
Hi,

I implement TopStats in my forum poljoforum.rs/statistika.php, i want to use it in separate page out of forum.

Code for file Statistika.php

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: page.php ~ Stilithius $
* @copyright (c) 2005 phpBB Group

*
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

page_header('Statistika foruma');

$template->set_filenames(array(
        'body' => 'statistika_body.html')
);

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));

page_footer();

?>
and code for statistika_body.html

Code: Select all

    <!-- INCLUDE overall_header.html -->
    <h2>Statistika foruma</h2>
    <!-- IF S_TSRAT_ENABLE -->
<!-- INCLUDE recent_active_body.html -->
<!-- ENDIF -->
 
<!-- IF S_TSMVT_ENABLE or S_TSMRT_ENABLE or S_TSMAU_ENABLE or S_TSMAF_ENABLE or S_TSLVB_ENABLE or S_TSLRU_ENABLE -->
<!-- INCLUDE top_stats_body.html -->
<!-- ENDIF -->
    <!-- INCLUDE jumpbox.html -->
    <!-- INCLUDE overall_footer.html -->
I can see 5 most recent active, but cant's see other boxes. They are turned on in ACP.
Also tried to copy (can't post URL) from other topic sugested by martin123456 in statistika.php before page footer, only change is i get 10 recenet posts and again no other boxes.

TopStats on external page

Posted: 16 Oct 2012, 19:22
by Stoker
Undo what martin told you.
Open the top stats and follow the instructions.
Do the index.php edits to your custom php file and the index_body edits to your custom html file.
Thats it.

TopStats on external page

Posted: 16 Oct 2012, 19:52
by GROMOVNIK
Done, i can see other boxes, but i got error 204 and 244 in /includes/functions_top_stats.php.

TopStats on external page

Posted: 16 Oct 2012, 20:01
by Stoker
You have to tell more about the error. I know the lines, but need to know the error.
Also, is your board without posts?

TopStats on external page

Posted: 16 Oct 2012, 20:03
by GROMOVNIK
Errors:
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_top_stats.php on line 204: Division by zero
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_top_stats.php on line 244: Division by zero

No, my board have about 35000 post's.
poljoforum.rs/statistika.php

TopStats on external page

Posted: 16 Oct 2012, 20:06
by Stoker
We need some code from index.php
Open your custom page and find: $user->setup();
Add after $total_posts = $config['num_posts'];

TopStats on external page

Posted: 16 Oct 2012, 20:14
by GROMOVNIK
Done, working fine. Thank you very much. Just one more question, in table 5 most active forums, i got list, but number of posts is not matching with posts in forum, is there any error in counting or there is some other error? Thank's again.

TopStats on external page

Posted: 16 Oct 2012, 20:32
by Stoker
No, forum posts are fine. But doesnt count subforums. Only the actual forum.