Home · Articles · Articles


Choosing a Doctype

The choice of which doctype to use in your website is typically a no-brainer. You'd use the newest doctype because its recommended by the W3C and will give you the best support in the widest array of web browsers. So unless there is some special reason for you to use a legacy doctype, you would use the HTML5 doctype.

<!DOCTYPE html>

However, when coding HTML for emails, using the above doctype is not ideal because there are a whole number of elements and attributes that are still needed for email design. (i.e. cellpadding/cellspacing/align/width/etc.) – and these things are not a part of HTML5, and the W3C validator will throw errors if you validate your code with the HTML 5 doctype.

The HTML validation service will validate code against the kind of doctype that you have specified at the top of the code. So this definitely matters.

So for this reason, I recommend using the HTML 4.01 Transitional doctype. It's your safest bet.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

But if you’re not concerned with code validation, the HTML5 doctype is fine. Both of these doctypes will render Standards Mode.

Even though many web based clients already have their own doctype and will force us to use theirs, its always good idea to put a doctype in your emails to make them render in Standards Mode in web browsers, and to have fewer rendering issues.

Comments (0) | Tue Nov 8th, 2016

Simplest PHP Gallery

This is by far, the simplest way to create a photo gallery using PHP. If you can make it better (but keeping the code the same size or smaller) please let me know.

   $d = dir('./');
   $i = 0;
   while(false !== ($e = $d->read())){
           echo '<img src="'.$e.'"/>'.chr(10);
               echo '
'; } } ?>

All you need to do is crop/resize the images and drop them in a folder, then use this PHP script which to read those images (with the same .gif file extension) from the specified folder. It will display those images on the page and insert a line break after each 5th image.

With a small modification you can modify this script to use thumbnails or a lightbox popup. Surely it can't get any smaller/easier than this!

Note: I didn't write this particular script so I cannot take credit for it.

Comments (0) | Fri Oct 16th, 2015


A photo of BB-8, a character from Star Wars: The Force Awakens

I'm not talking about BB-8 or any other kind of robot that you've seen in movies. I'm talking about the kind of robots (called spiders) which crawl all around the internet gathering data.

Even Google has a very popular robot, called Googlebot. But did you know that you can send commands to these robots?

You can direct them to do, or not do certain things. If you upload a robots.txt file to your website, you have a measure of control over what these bots can do. For example:

User-agent: *

Sitemap: http://www.spektredesign.net/sitemap.xml

The above rule tells ALL incoming robots that they can crawl every page on your website. The asterisk means "all robots", but you can specifically identify a robot by name too (User-agent: googlebot) This code also tells them where the XML sitemap is located (which is important for SEO).

User-agent: *
Disallow: /cgi-bin/

This example tells all robots that they can crawl every page except for the "cgi-bin" folder on your website.

User-agent: *
Disallow: /images/
Allow: /images/pinkball.gif

And this one tells all robots "Don't crawl the images folder, but you can only crawl the pinkball.gif file in the images folder."

Comments (0) | Sat Oct 10th, 2015

<< First < Previous [1 / 2] Next > Last >>