PDA

View Full Version : James Battersby Tutorial 01: How a website works


batterj2
09-15-2009, 04:41 PM
First, a quick note:
I have written a few tutorials on my site but as I approach a redesign (and the fact that the pages are being spammed by lots of horrible bots) I have decided to ditch the idea. However, rather than let them disappear I thought I would contribute them to these forums as a way of providing thanks to the help it has given me.

Disclaimer:
A few of these tutorials feature specific products and opinions. I do not work for any of the mentioned companies and these opinions (although shared by many) are my own. Take them as you will (visit my website for more information on my background).

01: How a website works

Before we begin we should make sure you fully understand what a website is and how it works. Consider this example and see how it maps to how you use the Internet.
Example Situation What You Do on the Web

You enter a library (You open your web browser)
You ask a librarian for a book on cats (You enter cats in to a search engine)
The librarian recommends books in a particular location in the library (The search enginer returns a list of website links)
You find a book (You click on one of the links)
You open the book at a particular page (You enter a website at a particular page)


A website is like a book: a collection of pages about a particular subject. Like an author/publisher of a book your job as a web developer is to make these pages to form a collection of pages known as a web site.

How Does the Computer See All This?

If you're reading this from a website (i.e. you haven't saved it or printed it out) then the computer you are using is part of the Internet. An Internet is a collection of networks of computers - it passes information from one computer to another computer via cables (or wirelessly) and other computers. The computer you are using now is a client machine because you are requesting information (this web page). The computer that is giving you this information is a server machine (it serves information).

Confused? Maybe a nice diagram will help.
http://jamesbattersby.com/cp/images/upload/ill01.gif
Illustration 1: Two completely different people in completely different places reading the same website.

Follow a path along the solid lines from you to the computer on the far right. Well done - you have just completed a request (for information). Now follow it back to you. Well done - you have just completed a response (of information). That is a complete transaction: you, the client, request information from the server which responds with the requested information. The above diagram can be simplified to show this:
1 http://jamesbattersby.com/cp/images/upload/ill02_a.gif Client REQUESTS a web page
2 http://jamesbattersby.com/cp/images/upload/ill02_b.gif Server looks for requested web page
3 http://jamesbattersby.com/cp/images/upload/ill02_c.gif Server RESPONDS with the web page
Illustration 2: How a client requests information and a server responds with it.

So, in conclusion, your job is to create the information that the server responds with. You don't have to worry how the server does this as it will do it for you. This is known as a web server which you now need on your computer to practice with.