• with a website that will stand the test of time
  • welcome to 18a productions web design
  • we'll help you grow
  • and stand out from the crowd

Archive for the ‘Web Development’ Category

Mar 06

Unleash the CSS - Creating Multiple Skins for your Site

Thursday, March 6th, 2008

How easy is it to change the entire look of your site? If your site is more than 2 years old and the slightest bit complicated I would imagine it’s pretty tricky…

The days of table based layouts are long behind us. Over the past couple of years we’ve seen a surge in the use of true CSS based layouts which is fantastic news for everyone. It makes designs typically much cleaner, files sizes much smaller and sites faster to load. Best of all, with the style elements of your site clearly separated from the content and stuctural elements you’re able to change the look and feel of your site very quickly and easily.

We’re just putting the finishing touches to a great new artist website CMS (content management system) that lets artists create quick and simple websites to showcase their work. The coolest thing, (apart from the use of the legendary Thickbox to update the pages, and the lovely galleries), is the ease at which the artist can literally switch the entire look of their site if they get bored of it, by logging in and switching the skin.

Check it out http://www.artist-websites.co.uk/designs. I think the daisy one is the coolest! ;)

Mar 03

New Social Shopping Widgets aid Online Promotion

Monday, March 3rd, 2008

It’s an increasingly crowded online marketplace, with everyone competing for the top spots on the search engines, beating each other up with adwords and fighting for all the traffic they can get. You might have the best products in the world, but if nobody knows you exist then it’s hard to get noticed.

That’s why we’ve just released some rather cool little widgets for online shops that bridge the gap between you the merchant and the user, giving you tonnes of free exposure for your coolest products. All in a simple bit of Javascript that brings all your best products to the naturalbornshopper.com community. Just add a couple of lines of code to your product details pages and you’ll get a lovely little badge showing how popular your products are. Complete with a link that lets our users vote you up the homepage of NaturalBornShopper.com and the associated shopping guides.

For more information take a look at the widgets page on NBS.
http://www.naturalbornshopper.com/widgets

Or contact us with your specific requirements and we’ll be happy to discuss how we can bring the NaturalBornShopper community to your site.

Feb 25

Social Bookmark Shopping.. What!?

Monday, February 25th, 2008

Hands up who’s heard of social bookmarking. I expect most people reading this article will have. The concept has been around for an Internet ‘eternity’ now. I thought everyone in the Facebook generation would be familiar with the idea, but I was speaking to a friend of mine yesterday, happily telling them about NBS and explaining how we’ve incorporated a ’social bookmark’ scoring system that’s a bit like ‘Digg for shopping’, and they were like “Dig what!?…”.

Sometimes I think we in the Internet business are in danger of losing touch with the vast majority of people that actually use the Internet… Our target audience… We get caught up in our own little worlds of digging, backing and blogging and forget what it’s all about in the first place.

And if you’re involved in the more technical aspects of website building like I am, you’re in even more danger of getting removed from reality as you have to compete with the ever changing platform on which you’re developing. (ajax, jQuery, browser standards, APIs, blah blah blah).

So just remember, when building a site don’t lose touch with the original purpose. Get an opinion from anyone willing to offer one. If someone says, “don’t ask me I’m hopeless on the Internet”, that’s exactly who you should be asking. If you can persuade them you’ve got a great idea, then everyone else should be a piece of cake.

Feb 22

Facebook Style Image Grabber

Friday, February 22nd, 2008

I love the way Facebook works; there are so many subtly clever gizmos that just make the whole experience that little bit smoother and pleasant. One feature I particularly like is the image grabber. For those that don’t know, if you enter a URL while writing a private message in Facebook, the site cleverly goes off to the URL and grabs all the images it can find for you. You can then select the image you want to include alongside your message. It’s a really sweet use of Ajax; subtle and very effective. This gave me the idea to develop a similar tool for use with our social shopping site. You can see the script in action here. It’s a simplified version of the code in production, but it works ok as a demo. (and please excuse the repeat of this paragraph on the demon page).

Feb 19

How to Generate an Image Captcha

Tuesday, February 19th, 2008

Everyone hates spammers, how they sleep at night I don’t know… Maybe they are so rich they can afford to buy those special space age mattresses that mold to fit your shape, or machines that imitate the sound of the ocean! (OK I got that from a film). But one tried and tested way of reducing your websites chance of being the victim of spam is to protect all your forms with an image captcha. The big sites like Yahoo have been using image captcha’s for years, but the idea of generating an image simply by writing code may be a little daunting for some. It was for me, until I actually sat down and gave it a go… Surprisingly it’s very easy, and I’ll show you how to create a basic image captcha in this article.

Everything I code is in PHP, so if you are looking for any other way of generating a captcha I’m afraid I can’t help you, although I suspect the principles are pretty much the same. In summary the basic requirements for this to work are:
a) You need to be able to use sessions
b) You need to have the gd library installed in your version of PHP. You can check to see if it is enabled by using the phpinfo() function. I’ve found that most recent installations of PHP seem to have it setup by default, so you should be ok on both counts.

In summary this is how it works:
i) You generate a random code
ii) You store this random code in the users session
iii) You also generate an image using PHP and display a distorted version of this code in the image.
iv) You ask the user to enter what they see in the captcha.
v) On the form submission you check to see if they entered what you already have stored in the session. If the two codes match then you have a human, if they don’t they you either have a very frustrated user or a bot, either way they get an error message and asked to try again.

See I told you it was simple! All that’s left for me to do it provide you with a little actual code to work on.

The Code - verification.php

This is the all important file that does all your work for you. It generates your code, saves it in the session and generates your image.

<?PHP

// Start the session for the user
session_start();

// Generate the verification number and store in the session
$verification_code = array();

// Create an image with 4 characters
for($i=0; $i<4; $i++) {
if(rand(0,1) == 1) {
$verification_code[] = chr(rand(97,122)); // Choose any lowercase letter in the range a-z
} else {
$verification_code[] = chr(rand(49,57)); // Choose any number in the range 1-9
}
}

// Save the code in the session
$_SESSION[’verification’] = md5(implode(”", $verification_code));

// Now we create the verification image itself
// We have 4 different background images which we’ll use to create the images
// You can create these in the graphics program of your choice.
// We then randomly select one of these images to use as the background for our image captcha
$image = imagecreatefromjpeg(”/path/to/background/images/background_”.rand(1,4).”.jpg”);
$text_colour = imagecolorallocate($image, 255, 255, 255);

// Add text to the verification image
$x_offset = 16;
foreach($verification_code as $chr) {
imagettftext($image, (22+(rand(-4, 4))), rand(-20, 20), $x_offset, (31+(rand(-5, 5))), $text_colour, ‘/path/to/fonts/trebuc.ttf’, $chr);
$x_offset += 22;
}

// Make sure the page isn’t cached and set the content type to image/jpeg
header(”Expires:Mon, 01 Jan 2002 05:00:00 GMT”);
header(”Last-Modified:”.date(”D, d M Y H:i:s”).” GMT”);
header(”Cache-Control:no-store,no-cache,must-revalidate”);
header(”Cache-Control:post-check=0,pre-check=0″,false);
header(”Pragma:no-cache”);
header(’Content-type:image/jpeg’);

// Finally we can send our response back to the user and free any memory associated with image
imagejpeg($image,null,100);
imagedestroy($image);

?>

Now to use your image captcha simply include it within an image tag within a form as follows.

<form method=”post”>
<input type=”text” class=”text” name=”verification” id=”verification” />
<img src=”verification.php” alt=”please enter the text you see in this image” />
<input type=”submit” name=”submit_button” id=”submit_button” />
</form>

Now when you submit the form the last check is to make sure the code entered in the form is the same as the code saved in the session that appears in the image captcha. As we md5 hashed the value in the session we need to compare like for like.

<?PHP

$error = array();

if (md5($_POST[’verification’]) != $_SESSION[’verification’]) {
$error[] = “Please re-enter the verification image. NB. All letters are capitals.”;
}

?>

Troubleshooting

The main gotchas I’ve found in the past were missing font files; you’ll need to download the .ttf file for whichever font you choose to use. These are available on the Internet (or even on your computer most likely). Just remember to upload them to your server and provide the path to them when calling the imagettftext() function. If PHP can’t find the font file you won’t see the image at all.

So there you have it, pretty simple really and a great bit of code to include in your web forms to help stop those pesky spam bots. You can see the code in action here.

Feb 18

Give your site an MOT

Monday, February 18th, 2008

We often have clients asking us to check out their site and see if there are any bits we’d suggest improving or changing, so I thought I’d just list my quick top things to check out for and make sure your site has. This is far from exhaustive so please feel free to add more at the bottom.

1. Do you have title tags on your pages? - Missing these out is a classic mistake and they’re definitely worth including. Make them relevant and on topic and unique for each page.
2. Do you have loads of JavaScript or CSS code at the top of your page? - It’s best to split your CSS and JavaScript out into separate .js and .css files. This might sound a bit technical but having this stuff bulking up the top of your code doesn’t help with your SEO.
3. Add alt tags to your images - This is vital if you want to get your site passed the HTML validators, but also very handy for ranking in image searches, for example Google images.
4. Are you *still* using tables? - That’s very 2005 :) It’s all CSS layouts these days. If you want to employ someone to code you a new site make sure they are using CSS based layouts.
5. Have you got an XML sitemap? - There are loads of tools out there for creating XML sitemaps and it may be worth creating one.

Nothing too strenuous there :) If you think of anything then please let me know and I’ll add it to a revised list.

Feb 15

Checking your site on Safari

Friday, February 15th, 2008

There’s an increasing number of Mac users who are impossible to ignore. I may even become one myself at some point as they do look pretty nice! If like me you’ve always coded websites on a PC in the past you might have been forgiven for ‘over-looking’ the small percentage
of people who use Macs. But this is all changing! Some say, “Once a Mac user, always a Mac user” and the new converts are changing sides in vast numbers. It used to be just music moguls and designers who used a Mac, but now even a few of my more ‘techy’ friends have started buying Macs.

Geek chic, where style, performance and function all come together in perfect harmony. So where does this leave the web designer? Well if you can afford it then I suggest you buy a Mac, install Safari and test away. For those that can’t afford the hefty
price tag, then check out browsrcamp.com where you can see what your site looks like on a Mac running Safari.

Nov 20

Magical list generator using jquery

Tuesday, November 20th, 2007

Just found this simple but effective javascript code, utilising the invaluable jquery library to create linked select lists. You select the first list and it magically goes off and generates the options in the 2nd and 3rd lists. This in itself isn’t anything particularly ground breaking, but this code connects to the database on-demand, then generates the menu options via a JSON response. I’ve just downloaded the code and at first glance it looks very tidy.

I’m not sure where I’ll manage to build this into a site just yet, but it’s nice to know if I ever do need it, there is a solution out there.
Maybe it could be used on registration forms where you want people to specify where they live… Getting the data itself could be tricky. Or maybe selecting categories/sub categories for a search. If only they had UK counties and cities in the attached db file too, now that would be handy! :)

Anyway here’s the code

Nov 07

Resources for Web Design (tutorials, tools, code libraries, templates and more)

Wednesday, November 7th, 2007

Some great links to resources for design tutorials, inspiration, tools, code libraries, browser bugs, galleries, templates, articles and web forums.

http://www.softwaredeveloper.com

Nov 05

Future-proof your CSS with Conditional Comments

Monday, November 5th, 2007

Anyone who has ever made a website, then tried to make it look the same for everyone will have come up against the nightmare that is cross-browser compatibility. Things are no doubt easier than they used to be. Back in the days of ie4/5 and Netscape you practically had to have different versions of your website, or atleast different javascript files. Nowadays the main issues tend to be around CSS and often relate to IE’s inability to abide by the rules. Much of this has been fixed in IE7, infact off the top of my head I can’t think of any issues I’ve personally had with IE7, but unfortunately there are still bazillions of IE6 infected computers which the poor web designer is obliged to support.

In the past I’ve used many a hack to get the job done, but a ‘nicer’ way of doing things is to use conditional comments. Why not take a look for yourself on Bruce’s website.

http://www.brucelawson.co.uk/index.php/2005/future-proof-your-css-with-conditional-comments/