- Where are we?
- This lesson’s goals
- Web site goals
- For the users
- Changing the Web site
- What now?
Where are we?
Let’s look at another application. Understanding it will help you understand why database stuff is done the way it is.
This lesson’s goals
Recall that DogRock’s site shows articles about dog rock music. It’s a content management system (CMS).
In this lesson, we’ll look at what the site does. Later, you’ll see how it can be built.
By the end of this lesson, you should:
- Know the business goals of the site.
- See how the site achieves those goals.
Web site goals
The DogRock site has three main goals:
- Users can see a list of articles, and read each one.
- DogRock’s writers can add and change articles, quickly and easily.
- DogRock’s Webers can update the Web site, quickly and easily.
You can try the site. The admin pages don’t actually change the database.
You can download a zip file of all of the sites files.
Let’s talk about each goal.
Users can a list of articles, and read each one
Users want to get to new articles quickly. They also want to be able to access a list of older articles.
Each article has a title, a body, an author, and a publication date. Users want to be able to see a list of articles sorted by publication date, so they can see recent stuff. They also want to be able to sort by title and author.
Writers can add and change articles
DogRock’s writers are not computer experts. They can handle some basic HTML tags, like
<p>, but that’s about it. They don’t know how to create entire Web pages.
We’ll create an administration section of the Web site. Writers will use forms to add and change articles. We’ll let them delete articles as well.
Webers can update the Web site
We will want to change the site. Maybe change the color scheme, add buttons to the nav bar, change the page footer, etc. Webers should be able to make these changes quickly and easily.
We’ll make a template-based site.
For the users
Time for some screens. Here’s the home page:
Figure 1. Home page
The latest three articles are listed on the home page, from most recent to least recent. You can try it.
Notice the nav bar on the left. This will be the same on every page. Users can click on the Articles button to see a complete article list.
Here’s the article list:
Figure 2. Article list
Clicking on the column names (title, date, and author) sorts the list. Clicking on the title of an article shows the article.
You can try it.
The administration section of the site lets writers add, edit, and remove articles. The administration section is just a bunch of Web pages.
There is no clickable link from the main part of the DogRock site to the administration section. To get to it, you need to know the URL. Add
/admin to the home page’s URL to get to the main administration menu.
Main administration screen
Here’s the main administration screen:
Figure 3. Main administration screen
There’s a link users can click to add a new article.
All the articles are listed. It looks like the article list, but each article has an Edit and Delete link.
Adding an article
Here’s the form for adding an article:
Figure 4. Adding an article
There are three fields:
- Author name
Some PHP sets the publication date when the article is saved.
Changing an article
The user clicks an article’s Edit link to edit an article record:
Figure 5. Edit link
This goes to a page like the add article form, but with the fields filled in.
Deleting an article
When on the main administration page, writers can click the Delete link to remove an article:
Figure 6. Delete link
This shows a confirmation page, to make sure the user really wants to delete the article record:
Figure 7. Confirm delete
The user has to click the Confirm button to actually delete the record.
Exercise: DogRock tasks
Using a site is a good way to get to know it. But you should use it in the same way that other people would use it.
Pretend you’re a DogRock reader, who wants to read the latest article. Start at the site’s home page. Write down the steps you would take to complete the task.
Now pretend you’re a reader who wants to see what Bounder has written. Start at the site’s home page. Write down the steps you would take to complete the task.
Now pretend you are a DogRock writer. You want to fix a spelling error in the article “A new howl on the prowl.” Start at the site’s home page. Write down the steps you would take to complete the task.
Put your answers below.
(Log in to enter your solution to this exercise.)
Changing the Web site
We want to make it easy for Webers to change the site. We’ll use the PHP template approach we talked about before.
So we’ll be using PHP for two things:
- Manage article data.
- Assemble pages from template components.
The DogRock site lets:
- Users see a list of articles, and read each one.
- Writers add and change articles, quickly and easily.
- Webers update the Web site, quickly and easily.
Each application – DogToys and DogRock – uses a database. Let’s see how you create a database, and then add a table to it.