Articles
Static verses database driven websites.
Introduction?
This article is intended to cover the following:
- what is the difference
- why you would choose one over the other
- how to recognise each
...
The difference between static and data driven websites
A static web page has certain text within it, and each time the server serves the page then some information is displayed.
Lets take the example of a product catalogue page.
Using static pages, you'd have a page for each product. This is probably fine if you have 5 products as you can easily maintain the pages. The pages might be called:
ProductA.htm
ProductB.htm
ProductC.htm
ProductD.htm
ProductE.htm
When you come to add a new product all you have to do is create a new page called ProductF.htm, and link to that page from the other pages. Easy!
Now, let's imagine that you've got 1000 products. If, when you add a product you have to update all 1000 pages to add in a reference to your new product you'll realise that there's a problem.
With 1000 products, a database driven site should be able to use one page - this page might be called Product.asp and to view each of your products, you might provide a link to
Product.asp?Product=1
Product.asp?Product=2
...
Product.asp?Product=1000
The page is a template with place holders where the data is to be inserted.
When you ask for the page the web server goes to the database, looks up the data that you've asked for (using the parameter) and fills in the gaps with data from the database.
Note that the product chosen might depend upon many things - selecting an item from a menu, whether you are logged in, which page you visited previously...
Some of the things that can be done with a database driven site are:
- Extensive product catalogues
- User specific pricing (depending upon who is logged in)
- Complex calculations from data entered
- User registration
- Newsletter requests
- Automated quoting
- Service call tracking
Reasons for choosing static or data driven sites.
You might choose a static site for the following reasons:
- Cheaper to set up
- Simple to update text (but not layout)
- The data is not often updated
- There is no requirement for anything more complex
Most marketing websites fall into this category.
They are a set of 5 to 10 pages that provide all the information about a company and remain generally the same for a reasonable period of time - 2 to 3 years.
A database driven website may be chosen for the following reasons:
- Many similar pages required with different data
- The data needs to be maintained by non IT people (ie a content management system)
- You need to ensure consistency of style and information across all pages
- You have to perform calculations
- You want to record user details or control access
- You have data that changes frequently
- You have client specific data
- You have job adverts that you want to update regularly
- You have news items to post on the website
Recognising database driven websites
Most static websites will have a page name (in the address bar of your browser) that ends in .htm or .html.
Database driven pages can have one of many page names, and the page name is often followed by some more information (though not always). Some examples are:
Each of these denotes the language used to write the page. For example, .asp means that the page is written in a combination of HTML and Microsoft Active Server Pages.
The middle ground
A site does not have to be completely either one or the other. It is possible to combine the two systems.
Often it is most sensible to have a static HTML page for the contact us page (it will not change very often)
but a database driven page for the price list so that prices can be updated easily. An example sitemap may be
- Home - static
- Company History - static
- Product section list - db driven
- Section 1 - db driven
- P1A - db driven
- P1B - db driven
- P1C - db driven
- Section 2 - db driven
- P2A - db driven
- P2B - db driven
- P2C - db driven
- Company News - db driven
- News Items 1 - db driven
- News Items 2 - db driven
- Contact Us - static
- Directions - static
What is important about this map is that all the product sections are shown on a single page, and each product is displayed on a single page.
This means that in total there are 4 static pages, 3 pages for the products and 2 pages for the news items.
Conclusion
This is simply a case of picking the features that you need for your website and selecting the appropriate technology.
If you're looking for a marketing site that will not change very much, static HTML is the correct answer.
If you're looking to do more, and can justify the cost with return on your investment then a database driven site may be the answer.
Article by NettMore Limited
read more on web development >>