Graphic/Web Design Blog


A great resource for web and graphic design for beginner and advanced designers. Learn about Adobe Software, XHTML, CSS and PHP coding, Design Jargon and other resources to help you.

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.

Note:
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:

<?php
define(’_BBC_PAGE_NAME’, $_SERVER['REQUEST_URI']);
define(”_BBCLONE_DIR”, “../website/bbclone/“);
define(”COUNTER”, _BBCLONE_DIR.”mark_page.php”);
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:

bbclone sample

This is the complete path to the page minus the root directory.

Note:
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.

Share and Enjoy:
  • Digg
  • Design Float
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • E-mail this story to a friend!
  • Furl
  • LinkedIn
  • Print this article!
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis

Tags: , , , , ,


3 Responses to “Using BBClone with WordPress”

  1. Php Coding Says:

    Good site I “Stumbledupon” it today and gave it a stumble for you.. looking forward to seeing what else you have..later

  2. Php Website Code Says:

    anybody here know of a good site to find more info on php website code? I\’ve got this site bookmarked and im gonna keep checking it out, but i still would like to find a site that covers php website code a little more thoroughly..thanks

  3. Web Design Says:

    Really fantastic article, very useful!

Leave a Reply