The IE9 hate starts here…

Made me grin/grimace….

A piece on how retarded Microsoft’s latest incarnation of Internet Explorer may turn out to be, despite the hype:

http://css3wizardry.com/2010/08/14/ie9-is-the-ie6-of-css3/

Oh dear.

No Comments

On CSS image replacement techniques and SEO

Having learnt that properly structuring headings is very important to SEO but wishing to be able to style and design pages beyond the limitations of HTML text I’ve often reverted to this old CSS hack to replace heading text with nice image substitutes:

.hide {visibility: hidden; display: block; line-height: 0; font-size: 0.1em; height: 0; margin: 0; padding: 0;}

I’ve been wondering about whether this is still good practice recently and found today that I’m not the only one… thanks to Laura Carlson’s [webdev] Web Design Update newsletter (subscribe already! HERE) I seem to have found a reasonable debate in this post and subsequent comments from Roger Johansson on his site at 456 Berea Street. In short:

  • Avoid using CSS techniques to hide text from your site. Especially avoid hiding text that contains keywords that are important to your site.
  • If you want to provide an accessible format of text that is in an image – use a regular image with alt text in preference to any CSS background image replacing actual text. CSS sprites may be very useful to reduce server requests and page load times but use sprites for pure graphic elements only – not text.

In a moment of clarity I realise that an image is valid within a heading tag… but whether alt text within an image within a heading tag is as strong for SEO as regular text in that same heading tag (whether or not hidden/positioned off-screen) is a question that could do with a clear answer. I suspect that alt text is not as strong: clear guidelines from those Google folks (I do love you) seem to be lacking again. SEO and graphically rich websites are not something that the engines of Google can cope with properly when faced with trying to be a sh*t umbrella (in gmail or the wider web) against the legions of spam pedlars out there who would love to stuff keywords into every corner of a page. In the meantime the life of a web designer remains tough.

Poor me.

,

No Comments

PHP web forms

Websites are a point of contact – and a contact form that sends an email is the way to normally handle enquiries. (Of course phone numbers/addresses must first be easy to find!) A contact form requires a web server to actually do something – ie send you an email – it’s not just displaying HTML code anymore. There’s options to get by without a script on your server – the excellent WuFoo online form builder is a great option here – but if you want a form as part of your page that you can style yourself it ain’t the ticket. So, knowing a little PHP, a PHP script is sought that:

  1. makes sure all input is cleaned and sanitized to avoid nasty things being done on/to your server
  2. checks for errors in the data without discarding the well formed data
  3. uses some form of CAPTCHA to keep those spam bots at bay
  4. sends email through an authorised SMTP email account (Gmail, for example, will either mark as spam or simply not accept mail that isn’t)

Other nice things to consider would be nice, cross-browser (HTML5) placeholder text (that doesn’t get submitted).

Finding a PHP web form framework

Last time I set up a form was a while ago – I’ve been doing mostly WordPress sites (or other CMS work) recently and have found the premium Gravity forms plugin for WordPress to work a treat. Anyway, cut to the chase already… the old script I had used  failed on points 3 & 4 above I’d like to say I can lean on PEAR PHP (which is already on my webserver) but I’m really not a programmer. I found a solution in the excellent PHP form “library” from Dagon Design. I’d never heard off it but it’s the first serious result for “PHP form script” in Google at the moment – so it  must at least be popular. More importantly it ticks all the boxes above (plus much more) and is well documented. Go get it. The only thing it doesn’t do is verify numerical input.

There’s no need for me to go into the setup at all – it is very well documented – just spend a half hour or so to read through it.

Adding placeholder text to the form framework

All I have to add is that I’ve edited the script a bit to set default text as HTML5 placeholder text (and remove default text from text inputs). The form is run in conjunction with Daniel Stocks’ HTML5 Placeholder Plugin for jQuery to make sure that the placeholder text works with IE etc.

To get the placeholder text working I changed the last few lines of the  below (from 754):

function ddfm_gen_text($item) {

	// type=text|class=|label=|fieldname=|max=|req=(TRUEFALSE)|[ver=]|[default=]

	global $form_submitted, $form_input, $show_required;

	$req_text = (($show_required) && ($item['req'] == 'true')) ? '<span class="required">' . DDFM_REQUIREDTAG . '</span> ' : '';

	$gen = "";
	$gen .= '<p class="fieldwrap"><label for="' . $item['fieldname'] . '">' . $req_text . $item['label'] . '</label>';
	$gen .= '<input class="' . $item['class'] . '" type="text" name="' . $item['fieldname'] . '" id="' . $item['fieldname'] . '" value="';

	if ($form_submitted) {
		$gen .= ddfm_bsafe($form_input[$item['fieldname']]);
	} else if (isset($item['default'])) {
		$gen .= ddfm_bsafe($item['default']);
	}

	$gen .= '" /></p>' . "\n\n";

	return $gen;
}

to:

	if ($form_submitted) {
		$gen .= ddfm_bsafe($form_input[$item['fieldname']]);
	}

	$gen .= '" placeholder="' . ddfm_bsafe($item['default']) . '" /></p>' . "\n\n";

	return $gen;

So what’s all the fuss about – well you can see the version I worked on, in action, as part of a website for this fancy (in the good sense) hair salon in Fuengirola

, ,

No Comments

Got an “Error establishing a database connection” in Mac OS X 10.6?

At some point in the last month (been on holiday mostly) an Apple system update caused MySQL to stop running – all local development sites using MySQL would give the dreaded “Error establishing a database connection” error message. And phpMyAdmin refused to recognize my user/pass credentials.

It seems that Apple has once more made it necessary to explicitly state the MySQL default socket. As stated in this post Mac, WordPress: “Error establishing a database connection” you should edit the mysql.default_socket = line in your php.ini file to read mysql.default_socket = /tmp/mysql.sock

If you don’t know where to look it’s to be found in an invisible folder at the root of your hard drive called “etc”. To get there go to the menu bar when in the Finder: Go -> Go to Folder… or use this shortcut: [Apple]+[Shift]+G ) then type: /etc .

I’d recommend the excellent (and free) TextWranger to edit the file – as it makes it a breeze by automatically authorizing your changes with a prompt for you admin password when needed.

The change is easy – find the line that reads mysql.default_socket = then add /tmp/mysql.sock to the end.

The line should now read  mysql.default_socket = /tmp/mysql.sock

Save the file the restart your Apache webserver by going the System Preferences and stopping, then starting again Web Sharing (found in the Sharing pane).

1 Comment

Getting a local version of Cufon running on a Mac

The easiest route to web fonts, Cufon, is suffering a couple of issues at the moment – somebody may be trying to give the service a hard time with a nasty font.

If you ever have this trouble getting a local version on your MAMP server is no problem…

First you’ll need to get the open source fontforge package. If you have MacPorts installed that makes it a breeze… (installing MacPorts is also a breeze). As instructed at the fontforge site; just type this into Terminal: sudo port install fontforge. It’s not particularly quick – took  about 15 minutes – but that ain’t too bad. No.

Then go to cufon’s github repo and download the source files. Get these files into your Sites folder (e.g. to ~/Sites/cufon/)and all that’s left to do is edit ~/Sites/cufon/generate/settings.ini so that it points to the MacPorts install of font forge: fontforge=/opt/local/bin/fontforge. (If I remember rightly all MacPorts binaries go there.)

Now your local copy of Cufon should be working just go to ~/Sites/cufon/generate/convert.php and all should be hunky dory.

No Comments

How to tile a print using Adobe’s Creative Suite (CS5)

Do you need to print an oversized graphic document onto multiple sheets of paper (that your printer can handle) so you can then assemble/[Sello]tape/mount an accurate large format version?

This is a very simple task but strangely difficult to find an answer for. It’s not readily possible with any of the main Adobe CS5 (design premium) apps but Adobe Acrobat Pro can do it without breaking a sweat. Just print the document: if it’s too big for your printer then you’ll be able to select “Tile all Pages” in the Page Scaling pop-up menu. The options are quite limted but at least you can have crop marks and page information printed on each sheet (a definite plus).

To get decent trim/bleed settings I’d go to Illustrator and set up multiple accurately aligned artboards (multiple artboards a feature of Illustrator since CS4) and print them.

Anyway now I can get on with printing large format [proofs and "art" prints] without having to go to the next town…

No Comments

Safari: how to restore all windows from last session using Time Machine

It’s really very simple – everything you need is in ~/Libaray/Safari/LastSession.plist just quit Safari and restore that file from when it was good and you’re done.

What’s this about?

Well I tend to use open Safari windows/tabs to help keep me focused on foreground tasks while minimising backround/interesting/to-do articles etc. Occasionally I forget to restore all my windows after restarting Safari for a quick session (usually whilst preparing for shutdown/restart/software update).

Next time you try to restore all your windows and don’t get what you expected – remind yourself this is why that extra Time Machine disk was such a useful investment.

Hope this helps.

No Comments