Archive for the ‘Web Development’ Category

In my latest plugin, Custom Title Attributes, I needed to learn about Pattern Syntax to get what I needed working. To put this simply, I needed to replace one specific section of a string with another. Usually this would be easily done using the string replace function, however this only works if you know what string to search for in the first place.

With my plugin I had to match a pattern instead of a specific string to get what I needed. This can be achieved using a form of preg_replace() which was the preg_replace_callback() function. I'm not about to go into detail as to how these work just now. My point of this post was simply to mention the page (besides the PHP manual) that has really helped me out and explained things so clearly that I felt it deserved a mention and a thanks. So if you're interested in understanding pattern matching and regular expressions then I highly recommend reading WebCheatSheet's article – Using Regular Expressions with PHP.

More clients are slowly getting the idea of accessible websites into their head. You'll often find clients asking for something they've seen on another site, it's only natural. One fancy little thing is the option of allowing people to click a button that controls the font size of the site. Yes, a good browser should do this for you (providing your style sheet is coded to allow it) however a lot of people do not realise that they can alter the size easily via the View menu. Your best option is to educate your visitors but not everyone is prepared to sit and read about how they can use their browser properly.

I see people asking about a font size switcher and are usually told to use JavaScript or are perhaps referred to an old article on A List Apart called PHP Switcher. Personally, I wouldn't use JavaScript as not everyone runs it. I know people who have played with their settings and switched it off without realising it, and others choose not to run it. Plus, why use JavaScript when a server side language can do the job just as well ;) The PHP Switcher is a good article however it's not exactly what people are looking for, as this creates a drop down list, a jump menu essentially, using older PHP code (no Super Globals in use there!). I may have missed a more recent PHP Switcher article on ALA, but on a quick search I couldn't see anything jump out.

So how is it done with minimal work? It's fairly straightforward. First off I have to point out that any switcher will need to rely on cookies unless you intend to pass a variable through to every page on your site which will create a lot more work. A cookie is also ideal as it means that if the visitor returns on another day it can continue to remember their settings and this way they don't have to increase the text size again.

Continue Reading

The other day Deron wrote about how web developer's are treated when it comes to payment and essentially respect for the work you do. His main point was how so many clients want to pay very little for their web presence. A few good points were raised about how you usually (not always) get what you pay for, and how can web designers and developers prove that they're worth what they are charging. Sure, it's not always easy, especially for a developer such as myself.

A designer can show off their skills by showing designs of sites and work they've created. It's very hard for me to say "here's some PHP code and it does this" and for a client to understand and realise whether my code is any good or not! Sure I can show an end product of a working website, doesn't mean the code is any good, it just means it works ;)

So how else can you sell yourself and your business as the one to hire? With so much competition going on these days, be it good or bad, you need to try and ensure that you can prove to clients that you are the best person for the job. Luckily I get most of my work through word of mouth so people are coming to me because I've given a good service to someone they know. However there's still the job of ensuring the client is aware of what they're paying for, why they're paying for it and why they shouldn't go to their 13 year old nephew to do the same job!

Today we were in London for a meeting to, in part, do this with a new client. Besides the 2 hour meeting discussing what he needed to do and think about for improving his website, we spent time explaining all the various methods of marketing and exposing the site to a wider audience. Information on how we would set the site up, why we would ensure the site would conform to accessibility rules and the legalities of this, and how best for them to present their information and content on the site.

I think not only attending a meeting in person can go a long way to make a good impression, attending a meeting in a place 4-5 hours away from where you live makes a very good impression! Also having the confidence in what you do and what you are talking about will definitely shine through. Giving answers by using examples of other jobs or sites you work on is also great as the client can get an understanding of how much work you actually deal with and the type of companies you already work with.

These days, UK Business sites need to ensure compliancy to the Disability Discrimination Act which recommends that your site conforms to WAI Priority level II. Whilst no cases have been brought to court yet in the UK, the Royal National Institute for the Blind are active in contacting site owners when their site fails the guidelines (and it's been brought to their attention). To be honest, we do need a couple of court cases happening here (in my opinion!) so that UK business owners can actually appreciate the importance that who they hire can reflect on them and their legal obligations.

However, I'm deviating :D Making a good impression with a client is the point here. Taking your time to meet in person, actually explain the work involved (without getting too technical), offering advice and information when asked for it. All of these make that good impression, shows your professionalism and puts you in a good light with your potential new client.

Of course, if I had my way I'd rather not meet any clients, not have to talk to them on the telephone and just be left to write PHP code all day! But for the time being I can't do that, so I will go out of my way to go the extra distance when it's needed.

This post isn't strictly for WordPress users but I see it increasingly on WordPress sites so I'm targeting that as the main example. What am I talking about? Simple on page SEO AND Usability/Accessibility (it's not all about the Search Engines!).

Page Titles

Your page title is the most important aspect. You've got 50+ characters (around 65 I think, but search engines vary) so use them! Keep the main basis of the title unique to each page if you can, however I am a fan of keeping the main site title, be it a site name or company name, at the end of the title so that you still have consistency. Plus at a glance, in the search engine listings, people can still see which company/site you are from the title. I hate being on a site that just has the page title and no identification.

In WordPress it's not so straight forward but still perfectly possible. For standard blogging then your posts will take the same page title as the post title, so bear that it mind. For static pages it does the same, which isn't so good as you don't want 'Home' for your front page, or 'About'. However this can easily be changed with the SEO Title Tag Plugin. This allows you to set the page title for any page (or post). It's a must for anyone running WordPress as a CMS, and also those of you who use static pages on your site. However, if you're using WordPress as a blog then you need to alter your index.php template to allow you to control the front page title. To do this you can replace the standard title of

<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

and change this to

<title><?php if (is_home()) : echo 'Front Page Text Here'; else : wp_title(''); endif; echo ' - '; bloginfo('name'); ?></title>

On this line change the 'Front Page Text Here' to whatever you want displayed, and also change the hyphen to the separator of your choice in the second echo statement. This will then give you the page title followed by the blog name. On internal pages you'll simply get the page or post title followed by the blog name. It's a good idea to at least switch the wp_title() and bloginfo('name') around anyway in my opinion.

Headers

Ahh Headers. These seem to either be misunderstood or just abused, if they're used at all! Using the Web Developer Firefox Extension you can easily go to any page and choose Outline – Headings, and see what header tags are being used and where. It's often interesting to see how the same header tags are styled so differently on different parts of the page. Surely this should say to some people that perhaps they're using them wrongly?! Headers are also important for semantics and usability/accessibility. It creates a structured hierarchy within the page and as a result emphasises relationships between one section and another, and can be used by users of certain screen readers and browsers to navigate through the page based on the structure (yes I just got that from Dave!!).

From my point of view, headers need to be used right to define the right amount of importance to the text within the tags along with the content about to follow. I often see people either using multiple H1s on a page, or one H1 and then a load of H2s and nothing else. There's no structure there, not for the visitor and not for the search engines. Surely, to me, if you use to many H2s then it starts to dilute the importance of a H2 and perhaps a H3 can be seen as more important if there is only one of them. I'm sure it doesn't work like that but if you have everything in a H2 then everything is considered of equal importance, and that's probably not right.

WordPress is a major culprit of this and it's something I wish they'd change. By default, the template tags of wp_list_categories() and wp_list_bookmarks() both output H2 headers. This is quite annoying as you already have H2s around your post titles, are the headings of 'Categories', 'Blogroll' and anything else in your sidebar worthy of the same importance? Personally I don't think so. Changing these is fairly easy however.

For the bookmarks list you can easily add in a couple of extra parameters to control what the heading uses by specifying the before and after tag

wp_list_bookmarks('title_before=<h3>&title_after=</h3>');

For the categories list however you need to simply prevent the header from being output and manually do this one yourself using similar code to

<h3>Categories</h3>
<ul>
<?php wp_list_categories('title_li='); ?>
</ul>

The title_li= parameter tells the function what title to output, so by leaving it blank it's being told to output nothing.

Another misuse of headings that I often see on a blog post is the date below the title also in a header. Why?! The date is of no importance whatsoever. Sure, it should be there for definite, but not in a header tag. You're just diluting the importance of headers by throwing a date into one.

From my point of view there should be one H1 on a page. At the top and contains the site or company name. This is also consistent across the site. My H1 uses image replacement to show the header image of the rose with the PHP code, however 'underneath' it has my blog name. I then use H2s for my post titles and H3s for my sidebar headings IF I can't put them into definition lists which is what I'd actually prefer to use (and will be on the next theme). I also use H3s in my posts, hence why I'd rather not have them in my sidebar at all!

Summary

This isn't a guarantee on anything. I'm not an SEO, just applying some common sense and using what I've read on SEO sites. However SEO aside, semantics and usability dictate that you should keep your pages structured, follow a hierarchy and follow consistency. With CSS in use a lot more these days, it's not too hard to switch tags around, just assign the H3 the same style as the H2 had for your sidebar and you're usually fine.

Just a quick one before I go out. Just read about this from Will. SitePoint is giving away their full Ruby on Rails book for free, as an eBook download, for the next 2 months. So even if it wasn't on your to do list, grab the book in case you fancy looking at it in the future!

» Ruby on Rails Download

Page 3 of 19«12345»10...Last »