What is a FavIcon?

11 March 2009

FavIcons are usually found on the address bar on your web browser.

Being on this website you should see a blue coloured "P" inside a black box in the address bar. That is the FavIcon for this website.

If you look down your bookmarked websites you're bound to see all kinda of FavIcons from various different websites.

A FavIcon will make your website stick out in a list.

FavIcons are 16x16 pixel images saved as a .ico file (icon) and uploaded to the web server.

Once uploaded you need to add the following 2 lines to any page you want to display the FavIcon on:
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="icon" href="/images/favicon.ico" />

The href attribute needs to point to the location where you have uploaded the FavIcon to.

You will see the 2 tags above are practically the same, except one says "shortcut icon" and the other says "icon". This is because originally people used "shortcut icon" but as time has gone on web browsers also support "icon" and so some are thinking that in the future "icon" may take over from "shortcut icon".

To create a FavIcon I use an online tool where all I need is an image.

The online tool then takes my image, make it 16x16 pixels and then output the image in the correct .ico format.

The website I use is:

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

PHP header redirect function

10 March 2009

PHP headers can do anything from force download of a file, render the page as a different file format or redirect the page to another URL.

All PHP headers must be placed before anything is output onto the page.

We want to use the PHP code:

header ("Location: http://www.redirect.com");

If a PHP header occurs after text has been output onto the page you will get a list of PHP header errors.

To escape any errors from being output onto the page you can put the @ symbol before any PHP function, but the page still won't redirect.

In this case we want to hide the errors from being displayed, and still redirect the page.

Page redirects can be carried out using javascript as well like this:

<script type="text/javascript">

Again the flaw here is if the user has javascript turned off, which will result in the rest of the page being displayed.

The last result of redirect would be the HTML meta tag to refresh, with code like this:
<meta http-equiv="refresh" content="0;url=http://www.redirect.com" />

So all together we have 3 forms of page redirect and so I decided to make it into a function so that no errors will be displayed when redirecing and if the first method doesn't work then one of the other 2 methods hopefully will.

function redirect($url)
    if (!headers_sent()) //If headers haven't yet been sent
        @header('Location: '.$url); exit;
    else //Headers have already been sent
        echo '<script type="text/javascript">'; //Echo the javascript redirect code
        echo 'window.location.href="'.$url.'";';
        echo '</script>';
        echo '<noscript>'; //If javascript is turned off this code will execute
        echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo '</noscript>'; exit;

If this still doesn't work then you're doing something wrong!

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Does your website have sticky pages?

9 March 2009

Does your website have sticky pages?

Do your website visitors keep coming back?

Is there any reason for them to come back?

Does your website always offer something new for your visitors?

In order to keep your website visitors coming back time and time again you need to give them a reason to come back. Here's a few tips to ensure that your website visitors do keep coming back:

  • Keep your website up-to-date
  • Start a forum, blog or any means of user interaction so they can get invovled
  • Create an RSS feed for your website visitors to subscribe to
  • The website visitor won't come back if they found it hard last time, so make sure it's easy to navigate and find the information they're looking for
  • Give the website visitors a value and a reason to come back and recommend it to friends - this could be a good article or good blog
  • Keep a mailing list and contact them all from time-to-time
  • Tempt visitors back with a special offer, something of great value, or something for free

Having the same website visitors coming back to your website is also referred to as "Visitor Loyalty" by Google Analytics.

For a lot of people or companies the website is the main income stream and so is essential that visitors do keep coming back and also that they tell their friends about the website as well.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Choosing the correct navigation for your website

8 March 2009

You can have really good and useful content on your website, but what's the use if your website visitors can't even find it?

The navigation on a website is very important and should be thought about very carefully in the early stages of building a website.

The positioning should always be along the top or down the left hand side as users read left-to-right and from top-to-bottom and so it's more logical and good website practice.

The suggested short term memory can handle 7 items plus or minus 2 and so I'd suggest having 5, 7 or 9 main navigation links.

If you need more links then it's a good idea to divide your links into categories and have sub navigation for each main navigation link.

The navigation text needs to be informative, search engine friendly and not misleading or have multiple meanings. Link text is a good method in Search Engine Optimisation (SEO) and so the link text should include keywords if possible. Also having informative links will tell your website visitors exactly what they're going to see before they even click on it. Always make sure that the link text is not misleading, otherwise the website visitor may click there expecting to see something else, or they could get lost within your website, or even worse they may not be able to find the page they're looking for and so just give up.

Normal practice is to have your home page link first, as this is usually the first page that the visitor sees and normal practice is to see this link first.

After the home page link you should show your links in order of relevance but yet still as logical as possible.

If you plan to have a contact type page, or a page for useful links then these are usually 2 of the last links that you will see in the navigation. As this is normal practice I would always stick to this ruling as it's what most Internet users are used to and the last thing a website wants to do is confuse the user as this is a way to lose a lot of visitors quickly.

Always make sure that your website does have a contact page, or contact information easily visible - as if the wesbsite visitor can't find what they're looking for the last resort may be for them to contact you and ask for the information that they're looking for.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Problems with a flash website

7 March 2009

Flash is a different programming language to HTML, PHP, ASP and website publishing languages. To have flash on a website it needs to be added as a web object.

Web objects can't be crawled by search engines because any text you see within an object is part of the object - which search engines are unable to read. For this reason search engines are unable to read flash files.

If the whole website is built in flash then search engines won't actually see any of the website's text because it's all inside the object and so search engines will view it as a practically empty website. For this reason search engines will only see your website as being one page and won't be able to crawl other pages unless a sitemap has been submitted to the search engines.

Search engines won't be able to pick up any keywords or key phrases except for those in the meta tags. The only other help to search engines will be internal links from other websites.

Flash banners on a website would be ok because search engines will still be able to read the rest of the text. Except - Some web browsers have flash turned off as it can be seen as potentially dangerous to your computer, and older browsers can't handle flash files properly, and so the look of the website will be very different for some people.

Other media devices such as some mobile phones are still not all compatible to view flash successfully and quite often the website visitor will just be faced with an "F" icon to show that usually there would be flash content in this area.

These days a lot of websites are built using a Content Management System (CMS) and so updates can be made to the website quickly and easily by the website owner - whereas a flash website will need to go back to the flash developer in order for them to change the files.

Flash files can often be quite large and so may slow down the loading time of a website. Recent statistics show that if the website takes longer than half a second to load it will lose 20% of it's visitors. Google also doesn't like slow loading websites and so the page rank score can also be penalised.

In conclusion it is ok to have flash banners or small flash objects on your page, but you should avoid building the complete website in flash. It is more costly, can take longer to load, and although it looks good - it's not going to get you top Search Engine Optimisation (SEO) results. Any flash objects that you do decide to place on your website should always have a plane text alternative for search engines to see and also for accessibility reasons.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

What is RSS?

6 March 2009

Statistics show that most Internet users don't know what RSS is, and for this reason they wouldn't subscribe to any feeds.

RSS stands for Really Simple Syndication, although you may also see people using the terms Rich Site Summary or RDF Site Summary as well.

You will often see the orange RSS icon RSS Icon on a page, or you may see this icon on your web browser.

Internet Explorer shows the icon in a toolbar

Internet Explorer RSS

And Firefox shows the icon in the address bar

Firefox RSS

RSS is a way to syndicate with a website's feed and so be alerted whenever they add new content to the feed.

The feeds are usually used for news and for blog entries as these are constantly updated and so need to keep the website visitors up-to-date.

Once you click to subscribe to a feed you are shown a list of feed readers that you may want to use.

I personally use Google Reader and I find it really good. I have subscribed to about 10-15 feeds and each has it's only category on the feed reader. Any updated feeds (feeds with new content) are highlighted so they stand out.

On Google Reader you can also set favourites and share feeds with others. Every Google Reader account has their own public favourites page, mine is - www.google.com/reader/shared/15586057576910103121

A lot of people won't find RSS feeds useful, but if you're on the Internet most days and have websites that you want to stay up-to-date with then this is a perfect answer.

Keep an eye on all your websites from one feed reader.

With social networking and Web 2.0 so big these days, there's bound to be plenty of websites that you're going to want to keep an eye on.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Why use a CMS (Content Management System)?

3 March 2009

A CMS (Content Management System) allows users to input their own content and edit it easily.

Content Management Systems quite often have built in functionality such as being able to blog, setting up a forum, displaying a picture album, running a social network and whatever other functionality you can think of.

There are plenty of CMS platforms out there for people to download, and then upload to your own web space. After installing on your web space you can build your template files and add content to your website.

Some of the CMS platforms out there include (but are not limited to):

  • WordPress
  • CakePHP
  • Drupal
  • Joomla
  • Mambo
  • TypePress
  • CMSimple
  • Django

As well as all of these well know CMS platforms, I've also built my own, PJN CMS.

With a Content Management System the user will be able to create new pages, change te navigation order, add content to the pages, add functionality to pages and be able to update the content from any computer as long as they remember the username and password.

The beauty of using a Content Management System is that anyone can have a website, without knowing how to code in PHP or HTML.

The whole website will be consistent in layout and all content added should be compliant with W3C XHTML standards.

Permalink     Comments (3)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Google joins Twitter

2 March 2009

I received an email newsletter today saying that Google has just joined Twitter, I assumed Google would already have been a member and I'd already be following them - but sure enough Google has only been a member on Twitter for about 3 days now.

When I had a look Google already has 35,000 followers - and after just 3 days, I'd say that's pretty impressive!

Google's first Twitter update says:

I'm 01100110 01100101 01100101 01101100 01101001 01101110 01100111 00100000 01101100 01110101 01100011 01101011 01111001 00001010

Now I don't read binary, and I'm not sure whether my source is correct - but I have heard that this translates to "I'm feeling lucky".

When looking through the Twitter members that Google is following - it's very few compared to who's following them, but they're following Twitter members such as Yahoo and Live Search!

Here are some useful Twitter members who you should think about following:

Twitter really is growing fast, be a part of it.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

PHP force download for PDF files

1 March 2009

It's quite often on a website that instead of letting someone view a file online, and letting the user see the file path of where it's being stored, you use a force download script which means that the user has to download the file instantly.

I do my force downloads in PHP using the header() function. There may be other ways, but not yet that I'm aware of.

You want to be careful when writing a force download script as it may enable someone to download any file on your web server including your PHP and server side script pages.

The best way is to send the page an id number that can then be looked up in an online database and then the database will hold the file path so that the user won't be able to see it.

Force downloading a PDF is slightly different from force downloading other files because relative and exact file paths will cause the PDF to not open and give a "File Corrupted" error.

The "Content-Type" header shows the file type that the page needs to render for.

Here's a list of the content types that could be used for the different file extensions when carrying out a force download:

switch( $file_extension )
  case "pdf": $content_type="application/pdf"; break;
  case "exe": $content_type="application/octet-stream"; break;
  case "zip": $content_type="application/zip"; break;
  case "doc": $content_type="application/msword"; break;
  case "xls": $content_type="application/vnd.ms-excel"; break;
  case "ppt": $content_type="application/vnd.ms-powerpoint"; break;
  case "gif": $content_type="image/gif"; break;
  case "png": $content_type="image/png"; break;
  case "jpeg":
  case "jpg": $content_type="image/jpg"; break;
  default: $content_type="application/force-download";

Here's the code to force download a PDF file:

$filename = $_SERVER['DOCUMENT_ROOT'] . "/path/to/file/my_file.pdf";
header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-disposition: attachment; filename='.basename($filename));
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
header('Content-Length: '. filesize($filename));

The "$_SERVER['DOCUMENT_ROOT']" isn't needed for every file, some file types allow you to just use exact and relative file paths, but a PDF will throw back "File Corrupted" errors if this is not used.

The PDF force download code can be used for all files, just change the "Content-Type" header to the content type for the file you want to force people to download.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us