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.

Posts Tagged ‘text editor’

Using BBClone with WordPress

Thursday, December 27th, 2007

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.

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Windows Live Furl Netscape Yahoo BlinkList Bloglines Ask Newsvine Spurl Squidoo Fark Blogmarks Jeqq Sphere

Rate this Press Release