Page views (hits) mod

Articles and Information - phpBB 3.0 modifications and tweaks

Page views (hits) mod

Postby Mick » Sun Mar 19, 2017 1:07 pm

To install a page counter (not quite hits but close :gud )

Make a new php file with the following in it:
Code: Select all
<?php
/**
*
*‚ @package‚ phpBB3
*‚ @version‚ $Id:‚ hits.php‚ 1.0.1‚ 2008-08-02‚ 23:37‚ spyka‚ $
*‚ @copyright‚ (c)‚ 2008‚ spyka‚ Web‚ Group
*‚ @license‚ http://opensource.org/licenses/gpl-license.php‚ GNU‚ Public‚ License
*
*/

/**
*‚ @ignore
*/
if‚ (!defined('IN_PHPBB'))
{
‚ ‚ ‚ ‚ exit;
}

$hits‚ =‚ (isset($config['pageviews']))‚ ?‚ ($config['pageviews']‚ +‚ 1)‚ :‚ 1;
set_config('pageviews',‚ $hits,‚ 1);
$hits‚ =‚ number_format($hits,‚ 0,‚ '.',‚ ',');

?>

Note: Make sure there are no spaces before the first <?php and after the last ?>

call it hits.php then copy it to the root of your board.

In index_body.html find:
Code: Select all
<!--‚ IF‚ NEWEST_USER‚ -->
‚ ‚ ‚ ‚ <h3>{L_STATISTICS}</h3>
‚ ‚ ‚ ‚ <p>{TOTAL_POSTS}‚ &bull;‚ {TOTAL_TOPICS}</strong>‚ &bull;‚ {TOTAL_USERS}‚ &bull;‚ {NEWEST_USER}</p>
<!--
‚ ENDIF‚ -->

And replace with:
Code: Select all
<!--‚ IF‚ NEWEST_USER‚ -->
‚ ‚ ‚ ‚ <h3>{L_STATISTICS}</h3>
‚ ‚ ‚ ‚ <p>{TOTAL_POSTS}‚ &bull;‚ {TOTAL_TOPICS}‚ &bull;‚ Page‚ views‚ <strong>{HITS}</strong>‚ &bull;‚ {TOTAL_USERS}‚ &bull;‚ {NEWEST_USER}</p>
<!--
‚ ENDIF‚ -->


Refresh themes and templates.
"The more connected we get the more alone we become" - Kyle Broflovski
User avatar
Mick
 
Posts: 24
Joined: Wed Mar 15, 2017 9:14 am

Return to Articles and information

Who is online

Users browsing this forum: No registered users and 1 guest

cron