Using BBClone with WordPress
I love using BBClone as a quick on the fly page counting system. BBClone is a website counter written in php and gives the user a quick summary of who is on their site and where that visitor came from.
This post will be very technical assuming the reader has a basic understanding of BBClone and the ability to edit your blog’s source code with a text editor.
For starters this is the snippet of code you will need:
if (is_readable(COUNTER)) include_once(COUNTER);
There are two parts to this code that make it work with WordPress. The first is on the first line and is dark red. $_SERVER['REQUEST_URI'] will display this when a visitor hits a page:
This is the complete path to the page minus the root directory.
If you are familiar with BBClone those stats will make sense. For readers not familiar with BBClone this tells me I had a hit to my Changing Measurements Shortcut in InDesign blog post with referer digg.com and with a search query of indesign.
The green text on line two: ../website/bbclone/ is the path where bbclone will write to. This will be different depending what directory contains the bbclone files.
I have not been able to get it to work except when adding the code manually to the source code of each page in my blog.
What I did was opened the following pages in a php text editor: 404.php, archive.php, index.php, links.php, page.php, search.php, single.php and then looked for this code:
<?php get_sidebar(); ?>
<?php get_footer(); ?>
I placed the snippet of code directly after the get_footer() function. When I tried to place the code in the actual footer.php file all I received was error messages, so this was the next best thing.
Good luck, leave a comment if you get stuck and I will try to help debug.