Posted by kevin
March 9, 2010

0 Comments

WordPress Skeleton Theme for Developers

If you are a frequent WP developer then you’ll know the time consuming job of setting up a completely new theme. Today I have created a basic theme that is free to use for anyone creating a new site. It features a developer options page in the Appearance Panel where you can configure such things [...]

Posted by kevin
February 17, 2010

0 Comments

SQL JOIN statements

When working with relational databases, you will often find that the data your require can reside on multiple tables. In simple terms, a join statement brings together these tables using a common identifier. Joins are the best way to query a database whilst improving transaction efficiency.
An example
We’ll create two tables, a users and account table. [...]

Posted by kevin
January 5, 2010

0 Comments

Calculating the radius of a coordinate using PHP

Sometimes you’ll want to get the radius of a location. For this I have written a function that I’ll share with you.
/*

Copyright 2009 Kevin Bradwick (http://www.kevinbradwick.co.uk)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version [...]

Posted by kevin


0 Comments

Creating custom page layouts with WordPress

If you are using WordPress to create a website, and you want to avoid it looking like a blog, then you need to look at creating custom pages.
The ‘page.php’ file displays your generic page content using this template. You could customise this page to make it look as you want and set it as the [...]

Posted by kevin


1 Comments

Fixing the pagination error using custom permalink structure in WordPress

For a while this has been really annoying me. Whenever I use the permalink structure /%category%/%postname%/ I get 404 errors when using the next_posts_link() and previous_posts_link(). I a fix for this here. You can use this code in a themes functions.php file or use it as a plugin.
/*
Plugin Name: Fix Paging in Category Listings
Plugin URI: [...]

Posted by kevin


0 Comments

Grant remote access to MySQL

If you’ve installed MySQL on a machine other than your work station (localhost) and you want to use the MYSQL GUI tools to administer the server then you’ll need to grant remote acccess on the root account (or another account that has useful privileges. This is how to do it.
Connect via SSH and login to [...]

Posted by kevin


2 Comments

How to install LibSSH2 on a CentOS 5 system

Libssh2 is a C library implementing the SSH2 protocol for PHP. Here’s how to get it installed on a CentOS system running PHP 5.1.6.
First step is to install some dependencies.

yum install automake php-devel libtool openssl-devel gcc++ gcc

Next, let’s download the latest release of libssh2 (1.2.2 at time of writing), unpack and install

# cd /tmp
# wget [...]

Posted by kevin


0 Comments

Accessing a timezone list in PHP

The php function timezone_identifiers_list is only available in newer versions of PHP (typically 5.2+), although the php site suggests it is available in versions 5.1.0+. If you have CentOS (current version 5.4) or another linux distro that has 5.1.6 or similar, you may find the function does not exist.
For these situations, I have compiled a [...]

Posted by kevin
December 29, 2009

1 Comments

Foreign Key tutorial using MySQL

Foreign key’s in a database table reference primary key’s of rows in another table. Why does this matter? Well, if you have ever built an application whereby updating/deleting a row from one table requires further transactions to be carried out on other, you’ll know the nuisance and confusion this can cause (especially if your application [...]

Posted by kevin


0 Comments

Introduction to Doctrine’s Nested Set

A common problem requirement among developers is to store hierarchial data to a flat file database. You have probably come across the parent/child methodology whereby a table has a typical ‘parent’ column that references, you guessed it, its parent – this method is also known as adjacency list model. Querying in this way can often [...]

12»