You can try the IS at http://gamerz.cybercour.se/. Go there now. Open it in a new browser window, side-by-side with the window you’re looking at now. Makes it easier to talk about.
You can hide the blocks on the right of this screen by clicking the – (minus) that’s near the top of the blocks on the right:
Also, try shrinking this window, and the exhibition system window. They can get quite narrow.
Opened the other window? Good. Let’s get going.
Business entities and content types
Check out the Projects page. You see a list of…, well, projects. (The data is fake Latin text.)
A project is a business entity. That is, something an organization wants to track. Banks track entities like customers, and accounts. Manufacturers track entities like customers, and machine tools.
Drupal calls entities content types. A content type is something the information system (IS) tracks.
Project is a content type, and each particular project called a node. Nodes are also called records, and instances. Instance, node, record… all mean the same thing.
You can think of a content type as a set, and nodes as members of the set.
Fields
Here’s the Projects page again:
It shows the same information about each project:
- Name
- Homepage
- Description
These are fields. Fields are characteristics of a content type.
Don’t worry, that’s the last of the new words:
- Content type is a type of thing, like Book.
- Node is one thing of a type, like Pride and Prejudice and Zombies.
- Field is a characteristic of all the things, like Author.
Different content types have different fields. Car has Make, Model, Year, etc. Computer has CPU type, Memory, Screen size, etc. Different fields, except that…
Every node of every content type has a title field.That’s the only field a content type must have. The rest of the fields depend on the content type. A content type for dogs might have the fields breed, age, and weight, as well as title. A content type for university courses might have fields for course number, description, and number of credit hours, as well as title. Whatever the business wants to track, plus title.
A page for each node
Check out the Projects page again.
Click on one of the project names. You’ll see a page for the project.
Another example: sloths
Another example?
Yes.
Say we want to store data about sloths. The content type is Sloth. Here’s the sitch:
It’s kind of like we have a spreadsheet for sloths. Each row is a node, data about one sloth. Each column is a field, data about a characteristic of sloths. Then Drupal makes a Web page for each node.
Only kind of like a spreadsheet. There are things that content types can do that spreadsheets can’t. More later.
How to let users look at the sloth data? We make a list of all the sloth nodes:
The names are links. Click on one, and see the page for a sloth node:
That’s a common design pattern. Show a list of nodes. Click on the name of a node to see its page.
BTW, what we’ve been calling a “list of nodes” is called a view in Drupalspeak. Let’s use that term from now on.
OK, I lied earlier. There are four new words in this lesson:
- Content type is a type of thing, like Book.
- Node is one thing of a type, like Pride and Prejudice and Zombies.
- Field is a characteristic of all the things, like Author.
- View is a list of nodes.
Privacy detour
Back to Gamerz. Click on the Members tab in the main menu. Members is another content type. Notice the same pattern as before. A view of members.
Click on the name of a member, and…
Wait! We can’t click on the name, and see the page for the node! What gives?
Business people think about the data, not the Web page
More slothiness. (I want to be a sloth in another life. Or Snorlax.)
Say a user wants to add another sloth. Here’s the form they fill in:
Say they enter this data:
The user doesn’t have to think about the Web page for Amethyst, or her place on the list of sloths. The user just thinks about the data. The name of the sloth, and her attributes.
That’s what you want. Whether the content type is for customers, products, employees, whatever, the user thinks about the business, and lets Drupal do the tech stuff.
Based on the data the user entered about Amethyst, Drupal will create this page:
Drupal will add Amethyst to the list:
Drupal handles the details of storing and showing the data. The user thinks about sloths, not any tech stuff.
This is the difference between an enterprise-level system like Drupal, and make-an-easy-Web-site software. With make-an-easy-Web-site software, someone would have to manually change each list when anything happens. Ack! That’s a lot of manual work.
Make-an-easy-Web-site software is fine for brochure sites. But when you want to build real business IS, it’s not cost effective.
Exercise
(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)
Summary
A content type is something the IS tracks, like projects, members, customers, accounts, and machine tools. You can think of a content type as a set, and nodes as members of the set.
Fields are characteristics of a content type. Every node of every content type has a title field. But that’s the only field a content type must have.
A common design pattern is to show a list of nodes. Click on the name of a node to see its page. The list is a view in Drupalspeak.