I’ve been working on a 404 error page for the theme that I use here, Subtle.

I wanted to add error page support to the theme so I could utilise the error tracker plugin for Mint and also get search engines to adjust their listings for the website.

I wrote a funky bit of PHP code, which was inspired by A List Aparts: The Perfect 404 post.
What it does is look for a referral from a listed search engine and then get the keywords used in the search. It then assigns those keywords to the variable $new_search . That variable can then be used to populate your own search form.

< ?php
// Here we do some intelligent search engine 404 checking
// This allows us to show some links to possible relevant content
 
if(strlen($_SERVER['HTTP_REFERER']) > 0) {
 
    // We have a referer value somewhere
    // Look for a search engine query
    $engines = array('google.co', 'looksmart.co', 'altavista.co', 'msn.co', 'yahoo.co');
    for($I = 0; $I < count($engines); $I++) {
        $found = strstr($_SERVER['HTTP_REFERER'], $engines[$I]);
    }
    if(strlen($found) > 0) {
 
        // We have a search engine..
        // Split the referal up to get query used
        $query = explode('?', $found);
        $parts = explode('&', $query[1]);
        $part_count = count($parts);
 
        // Find specific search terms based on differing search engines
        $style = array('q=', 'p=', 'ask=', 'key=');
        $style_count = count($style);
 
        // start by looping through the URL parts
        for($s = 0; $s < $part_count; $s++) {
 
            // Match url parts against search query types
            for($t = 0; $t < $style_count; $t++) {
                $terms = strstr($parts[$s], $style[$t]);
                if($terms == true) {
 
                    // finish loop as we've found what we need
                    $s += $part_count;
                    $t += $style_count;
                    $terms = explode('=', $terms);
                }
            }
        }
        // Search terms to echo in the search box
        $new_search = str_replace('+', ' ', $terms[1]);
    }
}
?>

I’m sure the code could be tidied up a bit, but it does its job. Feel free to use it for your purposes!


I purchased a new lense for my camera yesterday so I’ve been playing around with it today.
I decided to get a Sigma 17 - 70mm Macro lense. The idea behind this purchase is so I can get in closer to subjects and take slightly more intricate shots.

Sunflower

Read the rest of this entry »


David ClimbingI had a brilliant trip up to the Lake District with Tim and Lorna last weekend. We went to get some climbing in before out trip to Italy in a few weeks time.
Unfortunately, due to the weather, we ended up doing more walking than climbing, but we still had an excellent time!

I’ve not been camping since i was a lot younger and it was nice to get out into the open and out of London for a short period of time.
We frequented several pubs are our days of walking/climbing and generally enjoyed the scenery that the Lake District has to offer.

I do have a load of photos that i need to sift through and get online as i think some of them came out quite nicely.
The photo to the left is courtesy of Tim and is of me attempting to climb in walking boots, which is a little harder than stickies!


Well
What can i say!
Its finally here. Bigger and hopefully better than before.
I hope you like the hard work i have put in to creating this new site. Lots more too it!

Ill run down a few things on the new site:

First of, i recommend you all registering. This enables you to post comments on posts like this one and other various “hidden” things dotted about the site.

Once you have signed up, you can login to the left and there will be a new “toolbar” appear where the login box used to be. This is your control unit shall we say and enables you to do limited things for the time being.
A user messaging system is currently being worked on.

There are some new features like the abuse section and the one-liner system.

Basically, signup and have a browse!

I would appreciate any errors be reported via the contact form.

Any old posters, if you have queries regarding the new layout please ask me anything you may like to know.

Take it easy.


This weekend ive been feeling a little ill.
Had the hardest work out ever at Tae Kwondo yesterday and that just exhausted me. I ache all over and feel like i have bruises all over me! Not good.
But, i return.
Got a nice little job to keep me sane until my girlfriend comes back from her holiday on friday. Its amazing how long two weeks seems when you’ve gotten used to being around a person almost every day.
Such is life i suppose.
I can’t believe how long my holiday from college has been. 5 weeks is a rather a lot of time!
Ordered some new cd’s on friday from amazon. Be nice to have some new things to listen too.
Got a couple of new DVD’s for my birthday. Must watch them at some point.
My net connection seems to be slowing down for some reason so i might just post this and call it a day.
Anyway people, take it easy. Ill be back tomorrow i imagine :o)

lotsa emails this way!