Archive for the ‘Web Development’ Category

Getting to number 1 in Google: An SEO case study

To try and increase sales and awareness at the JJB Sports website, I set about optimising the site for search engines and customers. The major success story was getting the site to the number 1 spot in Google (UK) for the keyword “nike trainers“. Here’s how I did it:

Read the rest of this entry »

My HTML/CSS templating system

When creating pages with HTML/CSS I like to make it as speedy as possible for both production and future maintenance. I make this possible with a very simple PHP template system.

Read the rest of this entry »

Bouncing back from confidence issues

This time, 3 weeks ago I was suffering from a massive crisis of confidence regarding my web development abilities, but this week the tables have turned and my confidence levels couldn’t be higher. Funny that.

I’ve always been happy to admit that while I’m not the best PHP programmer in the world, I am competent but, three weeks ago I was coming to the end of my tether whilst trying to write a small snippet of PHP code. the code was suppose to work out how accurately-matched certain pages within a CMS were to each other based upon the tags applied to them. I asked colleagues for advice which I got (but, couldn’t comprehend); I’d put the actual coding off while I thought about it for days; I’d written dozens of variants of a function for the task all of which didn’t quite work and came to a frustrating dead-end; I’d even drawn the problem out on paper in pseudo-code (numerous times) but nothing was working.

Read the rest of this entry »

How to stop yourself from completely fucking-up your website

A junior web developer often has a capability which in other professions is often reserved for exceptionally qualified individuals: the ability to completely fuck-up an entire business.

Many businesses are run completely online these days or their online presence is at least a major factor so anything that disrupts a website can be catastrophic. The very nature of the web, and how it works, means that it’s very easy when you’re making a change to a website to break the site completely.

Read the rest of this entry »

Creating People friendly URLs using PHP and MYSQL

Let’s face it people, URLs need to be people and search-engine friendly; People need them as navigational aids and search engines love those keyword-laden pieces of loveliness.

The challenges involved

It can be difficult to have a URL that represents the page title and fits in nicely without any <span>20 or random characters e.g. £</span>*&.

My favoured solution is to convert a page title into a URL friendly format and store it in its own field in the database. NB I don’t use it on this site but, Textpattern (which runs this site) does use a similar thing: e.g.


People friendly URLs using PHP, MySQL and mod_rewrite
becomes
people_friendly_urls_using_php_mysql_and_mod_rewrite

Here’s How

When creating a new page, be it a blog article, or a piece of news or whatever, I’ll give it a title and then just before uploading it to the database I’ll run it through a function that removes any nasty characters, then when I upload it I use two separate fields title and title_html.

the PHP

The function looks like this:


function create_url()
{
global $url;
$url_searches = array(” “,”á”,”â”,”ã”,”ä”,”Ã¥”,”æ”,”ç”,”è”,”é”,”ê”,”ë”,
“ì”,”í”,”î”,”ï”,”ò”,”ó”,”ù”,”ú”,”û”,”ü”,”fuck”,”shit”,”bollocks”,
“cunt”,”twat”,”tit”,”cock”,”dick”,”_-_”,”(”, “)”, “*”,”&”,”‘”,”!”,”%”, “/”, “?”,”£”,”$”,”%”, “,”);
$url_replacements = array(”_”,”a”,”a”,”a”,”a”,”a”,”a”,
“c”,”e”,”e”,”e”,”e”,”i”,”i”,”i”,”i”,”o”,”o”,”u”,”u”,”u”,”u”,”f—”,”s—”,”b——-”,
“c—”,”t—”,”t–”,”c—”,”d—”,”_”,”", “”,”",”and”,”",”",”",”",”",”",”",”",”");
$url = strtolower($_POST['url']); // turn url into lowercase
$url = str_replace($url_searches,$url_replacements,$url); // create browser-friendly url from title
return;
}

This code is far from perfect, as I am not a PHP expert. I invite people to improve this as it would be easy to do so.

Using it in the page

When the page is called a MySQL script grabs the webpage based upon that title as long as it unique e.g:


SELECT * FROM articles WHERE title_html = $_GET['title'];

It may be that you don’t even use the title to get the page, you may have an id or other variable in the URL that is used and the title is just for show. Either way, this is a technique that works and gets both peopel and serach engines to use your URLs effectively.

Alternatives

The other option, as I see it, is to run the function everytime on the site whenever you link to the page within your site eg:


<a xhref=”/folder/link<?= create_url($row['title']); ?>”>link text</a>

This is not the method I’d recommend as it adds more things to think about and more code throughout your pages.

Textpattern as a complete CMS

As part of my uni project, I have been implementing textpattern as a complete Content Management System. Due, to the fact, that when I was doing this I couldn’t find any information about it, I have decided to document how I did it.

Information Architecture

Before installing textpattern, I worked out the IA for the website in question (meaning what categories and sub-categories were necessary), so that, when it came to mapping that to textpattern it wouldn’t be so hard (yeah right!)

Read the rest of this entry »

.htaccess and .htpasswd

Today I’ve been struggling with .htaccess and .htpasswd in order to password-protect a directory on a site I’ve been working on.

I always find that when I google for help I get sites that kind of help but not 100% so here’s my problem and solution. Read the rest of this entry »

Phil Thompson

<img />... is the online home of Manchester web designer / web developer Phil Thompson.


Available for freelance work
07764754097
hello@philthompson.co.uk


Recent work

A mini-update of recent work.

See my portfolio for more work


Close
E-mail It
Socialized through Gregarious 42