Avoid Using Frames

“Frames allow an author to display multiple documents in a single window that is divided into rectangular subspaces called frames. Visual browsers allow these frames to be scrolled independently of each other, and links can be loaded in a frame without changing the content of other frames.

The HTML 4 frames model has significant flaws that make frames hated by many users. Frames should only be used with great care;…” – WDG

Frames pose a number of issues and reason for you not to use them in your site’s design/layout. I always preach against using frames unless it is absolutely necessary for anyone to use them. If you are going to use frames, make use to set the doctype correctly:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

This will declare the document to be HTML 4.01 Frameset.

Some of the main factors/reasons for not using frames are not all SEO related. The problems with frames are mostly related to accessibility and usability.

Any browsers that do not support frames will basically skip over the frame tags and the frames would not be displayed. There is a NOFRAMES element that allows the webmaster to specify content for these browsers that fail to show frames; this only means that he/she has to put in some extra effort.

On the search engine side, a cache version of the page that is in a frame does not store that fact that it was actually meant to be in a frame. When a visitor clicks on the link to the framed page, they go straight to the page and not to the parent page that includes the framed page. The visitor will them be viewing an incomplete version of the original page. There are scripts that can help to redirect the page to the parent page, but then again not all browsers will support the script.

Iframes are less complicated than using the above framesets, but they still suffer most of the same problems.

There are also CSS issues with frames. You cannot control the look and feel of a framed document with the CSS file of the main page. Some people have claimed that it is possible using JavaScript in the CSS, but I have not seen a working example yet. It just gets too complicated!

The bottom line is… avoid using frames! For company intranets there is no SEO concern and there will be cases where frames can be useful. Think carefully before using frames for websites; there is probably a better solution out there. Let us know if you have another solution…

The Difference Between SEM and SEO

I have had many ask me what the difference between Search Engine Marketing (SEM) and Search Engine Optimisation (SEO) is, so I thought I might throw a couple of definitions out there.

I am going to start with SEO, as it is a part of SEM. SEO is the act of optimising the HTML and other content of your website for relevant, targeted key phrases in order to attain higher natural listings than competing websites. SEO provides a cheaper long term solution for increased qualified traffic and generates customer inquiries that ultimately convert to sales.

Now SEM is broader than SEO. It includes SEO and other areas to improve a sites visibility in search engine results pages, like paid listings and paid inclusions.

You can think of SEM as more expensive and quite possibly more targeted, while SEO is free (not counting your time of course) and its purpose is to obtain better free search listings.

Personally, I would start with SEO and then move onto SEM.

PHP: If Number Negative Then Make Zero

In PHP, checking if a integer is negative and if it is then setting it to zero is easy, but I was looking for something shorter (and potentially faster) than:

if ($x < 0) $x = 0;

Well, this is a very quick check and reset, but there is a function max that does this too and it works with arrays too.

$x = max(0, $x); // $x will be set to 0 if it was less than 0

The max() function returns the number with the highest value of two specified numbers.

echo max(1, 3, 5, 6, 7); // 7
echo max(array(2, 4, 5)); // 5
echo max(0, 'hello'); // 0
echo max('hello', 0); // hello
echo max(-1, 'hello'); // hello

// With multiple arrays, max compares from left to right
// so in our example: 2 == 2, but 4 < 5
$val = max(array(2, 4, 8), array(2, 5, 7)); // array(2, 5, 7)

// If both an array and non-array are given, the array
// is always returned as it's seen as the largest
$val = max('string', array(2, 5, 7), 42); // array(2, 5, 7)

What is SEO?

Well I guess I should start at the beginning, for those of you who are starting out and want to learn exactly what SEO really is. To begin with, SEO is an acronym for Search Engine Optimisation, and what better place to obtain the perfect meaning for SEO other than Wikipedia: Search engine optimisation is a set of methods aimed at improving the ranking of a website in search engine listings.

So the main aim in SEO is to get your website to the top or as high as possible to the top of search engine listings. There are ethical and unethical methods of achieving this, but I believe in only using ethical ways and will focus on these only. Many search engines will penalise domains for “cheating”.

I will try my hardest to blog on SEO or tips on the topic, whether it be on site architecture, page content, or finding the suitable directories. My plan is to share as much as I can with you and who knows, maybe I can learn from you too!

Footnote: In some countries, for example the United States, the spelling is Search Engine Optimization. Google's definition of SEO is an abbreviation for "search engine optimizer".