Archive for the ‘Programming’ Category

Customizing phpBB Template Files

May 2, 2009

I spent the better part of today installing a phpBB forum on a new site (specifically phpBB 3.0.4).  This was my first experience with phpBB, and it looks pretty cool.  I won’t cover the install process here — there are plenty of great resources available for that — suffice it to say that it was very easy to install.

Once I had the software installed, I wanted to make some modifications to the header — include my own logo, etc.  This should have been easy, it’s just a matter of editing the overall_header.html file (download file via ftp, edit in text editor, upload, refresh).  But…no matter what I did, I couldn’t get my changes to show.  After quite a bit of time, I found a solution in a forum (yes, ironic).

To hopefully save others some frustration, I’m re-posting it here.  The key is that you need to refresh your template before the changes will show on the site.  To do this:

Go to Forum ACP->Style Tab->Template->Refresh your Template

That’s it!  Wish I would have known a few hours ago 🙂


How to Exclude Internal Traffic from Google Analytics Reports

February 12, 2009

There are two methods for excluding internal traffic from appearing in your Google Analytics reports: you can filter out a specific IP address or a range of IP addresses, or you can use cookies to filter out visits from particular users.  More info here.  I’m using the cookie method on my sites and have found it to work well.  This is the better method to exclude traffic from dynamic IP addresses.

How to exclude traffic by cookie:

1. Create a new page on your site containing the following code:

<body onLoad="javascript:pageTracker._setVar('test_value');">

Note that this code is in addition to the Google Analytics tracking code that you have on every page of your website

2. In order to set the cookie, visit your newly created page from all computers that you would like to exclude from your reports.

3. Create an Exclude filter to remove data from visitors with this cookie. Follow these instructions to create a filter with the following settings:

  • Filter Type: Custom filter > Exclude
  • Filter Field: User Defined
  • Filter Pattern: test_value
  • Case Sensitive: No

Now any visitors with this cookie will be excluded from showing in your Analytics reports.

Dreamhost, PHP Scripts and cURL

February 16, 2008

In an effort to teach myself basic programming, I have been playing around with stuff on my personal site. One thing I wanted to do was take the RSS feed from my blog and put headlines on the homepage of my site. I briefly considered trying to figure out how to do this myself, but quickly decided I would be better off just looking for an existing script that I could modify. I found a great PHP script (RSS2HTML) that seemed to fit my purpose perfectly. So I downloaded the script, customized it in TextWrangler, uploaded it to my Dreamhost server, tried to run it and…got the following error:

URL file-access is disabled in the server configuration

Well, this meant nothing to me. After a lot of research and trial and error, I found an article on the Dreamhost support wiki that says:

DreamHost has disabled the PHP option allow_url_fopen. This would normally allow a programmer to open, include or otherwise use a remote file using a URL, rather than a local file path.

I took this to mean that the script as written would not work on Dreamhost. Apparently the problem was the use of an ‘include‘ command in the script.

Here is the snippet I was trying to use:


The alternative, according to this article, is to use cURL. Well, long story short, this solved the problem and now it works great. Here is the new code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_HEADER, 0);

You can see the final product here. 🙂