22nd September, 2009
So finally I’ve switched my website to the new design, with a hefty number of new bits and pieces being added so you’ll have to bear with me for a little while as things get sorted out. Some of the bigger changes include integrating twitter (for which I have had an unused account for years) as a sort of microblogging tool, separating my university work from my professional portfolio and integrating a ‘Related Posts’ system which I have had in mind for a long time but have only just discovered a brilliant plugin that does all the hard work for me.

Above is a shot of a couple of the images I’ve produced for new site features.
You can find that related posts plugin at http://wordpress.org/extend/plugins/similar-posts/. Another plugin by the same authors is one that shows a list of the most recent posts. In the old design I had this functionality hardcoded into the theme footer but now it can be done with a single line of PHP.
28th August, 2009
I’ve been rather busy lately producing the PHP backend code for a document storage website and when it came to the question of where to actually store the files the answer naturally was somewhere outside of public_html so that control could be limited using the user authentication already available for the PHP pages. This meant that PHP would have to deliver a response as if the actual file itself was being accessed.
It’s pretty easy to find how to send alternative headers and a the source data from a PDF file: for example http://uk3.php.net/manual/en/function.header.php Additionally, there is plenty of information out there if you want to use ‘Content-Disposition’ to force the client’s browser to behave as if the file was a download rather than load Adobe Reader in the window itself.
However this was all fine until we discovered that Adobe Reader’s usual behaviour of displaying the first page and loading the document as it is being read was broken. This system is intended for some fairly large documents and the browser was choosing to download and cache the entire file before displaying anything. I knew immediately it would be something to do with the headers.
There is very little I could find that expanded on this issue, so using an online tool that can be found at http://www.askapache.com/online-tools/http-headers-tool/ I examined what response would be sent by accessing a PDF file directly from the server. Using this I could replicate the header in PHP and as I guessed, the issue was resolved:
header('Accept-Ranges: bytes');
header('Content-Length: '.$filesize);
header('Connection: close');
header('Content-Type: application/pdf');
20th August, 2009
I was looking through some old del.icio.us tags when clicking on a link brought me to a blog that had implemented a specialised greeting message based on the referer. I know grabbing a referer isn’t that hard but having never seen it put to this use before I actually felt this was quite clever.
A link to the plugin: http://www.phoenixheart.net/wp-plugins/referrer-detector/
12th June, 2009
A plugin that will produce similar links to those found at the bottom of a google or flickr results page.
http://wordpress.org/extend/plugins/wp-page-numbers/
Unfortunately this wasn’t quite what I was after, since it works with the existing pagination system of Wordpress.
29th March, 2008
As we continue to develop the Ocean Addict website it was decided that the forum needed to be as robust and powerful as possible so this meant installing additional forum software, in the form of a Simple Machines Forum. Once this was done, clearly there needed to be as much integration for users as possible, from logging in to styling the user interface, so I set about searching for a method of bridging Wordpress and SMF.
I quickly found http://wordpress.org/extend/plugins/wp-smf-a-simplemachines-bridge/, which seemed ideal. That is until after diligently following the installation instructions the plugin caused the entire site to break. Fortunately Wordpress’s plugin system can be rescued by simply deleting the offending plugin.
Searching for much longer wielded a solution based on the first. The stuff that can be found at http://www.earthorbit.com/opensource/ DOES work and works well.
15th March, 2008
For the Ocean Addict website I have been looking into open source solutions to creating a form of CMS to link together the main features now wanted for the site. An obvious choice might be something like Joomla! or Drupal but we have already got together the blog frontpage and a store, so instead the site is heading for Wordpress. I’ve heard of WP being used before as a CMS, it is known for its flexibility but until now I have never considered using it as anything more as a blog.
An excellent page bringing together a whole range of resources to do just this can be found at:
http://www.graphicdesignblog.co.uk/wordpress-as-a-cms-content-management-system/
Before now I have experimented with the nextgen gallery wordpress system and the wordpress simple forum.
27th October, 2007
I decided that I would like to create a breadcrumb links bar for the top section of each page of my new website design. A google search brought many many differing ways of achieving this using PHP however none of them seemed to concisely achieve what I needed. So instead I used a few of the most useful examples as a reference and created my own. The following are a good place to start I found, especially the first listed here (although last one I found):
http://www.sillybean.net/archives/452
http://www.zend.com/zend/spotlight/breadcrumb28.php
http://gr0w.com/articles/code/php_breadcrumb_links_creator/
Next comes the CSS for that general area, including my new design’s main navigation.