S

New Site Design Up and Running

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.

twitter-icons

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.

Posted in General Stuff, Web Design by Simon

PHP, Adobe PDF and Server Response Headers

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');

Tags: ,
Posted in Web Design by Simon

Referrer Message Plugin for WordPress

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/

Posted in General Stuff by Simon

Continued WordPress Post Numbering

13th June, 2009

My further experimentation led me to requiring the current number of a post which there is surprisingly little information about, so I ended up working something out from scratch.

I’ve posted it on the wordpress forum in case it proves useful for anyone else: http://wordpress.org/support/topic/245629

Update: Since this is now closed, I have included the code I made originally here:


function Get_Post_Number($postID){
$temp_query = $wp_query;
$postNumberQuery = new WP_Query('orderby=date&posts_per_page=-1');
$counter = 1;
$postCount = 0;
if($postNumberQuery->have_posts()) :
while ($postNumberQuery->have_posts()) : $postNumberQuery->the_post();
if ($postID == get_the_ID()){
$postCount = $counter;
} else {
$counter++;
}
endwhile; endif;
wp_reset_query();
$wp_query = $temp_query;
return $postCount;
}

Posted in Web Design by Simon

WordPress Post Numbering

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.

Tags: , ,
Posted in Web Design by Simon

WordPress and SMF Integration

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.

Posted in Work Placement by Simon

Content Management Systems Research

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.

Posted in General Stuff, Work Placement by Simon

Creating breadcrumb links

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.

Posted in General Stuff by Simon

Latest Journal Posts

RSS Feed

Additional

Bad Behavior has blocked 15 access attempts in the last 7 days.