Pattern 64: Store content in a database
AKA:

Back to Diagram 1 - Getting started Back to Diagram 2 - Useability Back to Diagram 3 - Adding detail Back to Diagram 4 - Workflow/security

View sensitizing image - POET

You are using SHORT TEXTS (44) to populate your site. You know that users will be annoyed unless the get NO UNPLEASANT SURPRISES (46). But your site is large and there is a need to update content frequently.

The problem is to maintain the site without having to cut and paste changes to hundreds of pages and make sure that changes to content to not interfere with the site’s structure.

Therefore

Put every separate page element that might possibly change into a database and construct page dynamically use server side includes. For larger, commercial sites use a content management system.

This pattern is terminal within this language, but obviously there is a lot more to learn about databases and content management in this context.


Discussion - forces - known uses

This pattern is a borderline case in terms of its relevance to usability. It does affect the usability from the point of view of the people who have to maintain the site of course, but it may just prevent the sort of unpleasant surprises that can arise for users when a change is not applied consistently across all pages. Therefore we include it in the language – just – but describe it only briefly.

The simple solution is to construct pages from elements that can be edited once and then included on the pages where they are need. This can range from things like price lists that are probably stored in a database anyway right through to page headers and textual content and on to the navigation and search engine areas.

Most web servers these days support Server Side Includes. This feature enables you to type the HTML for, say, the brand bar into a separate file called something like

branding.inc

and replace it in the page code with a statement such as

<!–#include virtual="/includes/branding.inc"–>

The server can now construct the page before transmitting it to a browser. The overhead should be well worth it.
Returning to actual content, one may divide it into short texts and images and store each fragment (HTML and all) in a database. To allow access to these data, create a index page that pulls the data that describe the content out of the database itself via Active Server Pages or similar. This allows you embed SQL queries in your code. If you are running your site at an ISP, be aware that not all ISPs permit this feature and check whether they do or not.

Databases do not assign meaning to the data they store. This means that a specific group of users cannot be targetted. Content management systems add a layer of semantics to a database, usually using XML, so that documents and sections of documents can be assigned meaning. In this way the data can be restructured for different users (personalization) or for different devices such as WAP phones. Content management systems are usually based on object-oriented database technology, which can provide better performance than relational systems in some cases, typically when the data have complex structures.

Large commercial sites and web services will almost always benefit from a content management system.

Browse the language What is Wu? Look at an example pattern sequence Structure of the patterns
Comment on Wu Contributors Return to TriReme home page Links to related sites