| CS 199 | Willamette University | Spring, 2019 |
|
Programming in PHP, Databases with MySQL, and Web Applications |
||
Much of this lab is an edited version of a lab by the same name, developed to support the book, The Tao of Computing: A Down-to-earch Approach to Computer Fluency by Henry M. Walker, Jones and Bartlett Publishers, 2005—copyrighted by Henry M. Walker, 2004, 2005.
To get started understanding how this document is produced in the given format, follow these steps:
Click on this link to view the abbreviated course syllabus in your browser.
Once you have this sample document in your viewer, view the underlying document. Instructions when utilizing the Safari browser follow (steps for other browsers likely are similar, although details may differ):
As you will see in the new source window, a typical HTML Web page has the following basic format:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
...
</head>
<body>
...
</body>
</html>
According to the standards of the World Wide Web Consortium (W3C), the
first line of the document must indicate the type of document and the
specific version of HTML being used. In this case the document type
(DOCTYPE) and the version follows the international standard for
HTML 4.01 TransitionalThis opening line informs your browser how to interpret the rest of the page.
In the lines that follow, formatting commands are listed in angle brackets: < > . Many commands apply for a section. For example, <head> marks the beginning of header information for the document, and </head> indicates the end of the same section. Similarly, <body> marks the beginning of the main body of the page, continuing through </body> near the end of the file.
The following table gives some common formatting commands, some of which are illustrated in this example:
| Command | Meaning |
|---|---|
| <html> | begin an HTML document |
| <head> | begin the header section |
| <title> | begin a title |
| <body> | begin the body of the document |
| <h1> | begin a header1 section (headers can be h1, h2, h3, h4) |
| <center> | center the material that follows |
| <p> | begin a new paragraph |
| <br> | break a line (begin a new line) |
| <b> | begin bold type face |
| <i> | begin italics type face |
| <hr> | draw a horizontal line |
While these formatting directives explain many of the elements in sample-html-page.html, the third line requires some additional comment. In HTML, a meta instruction is used to supply information about the page itself to the browser. In this case, this full line indicates that characters on this page are encoded according to a charset=ISO-8859-1 or "Latin-1" system that is suitable for most Western European languages. ("ISO-8859-5" would indicate a Cyrillic alphabet, "SHIFT_JIS" would specify a Japanese encoding, and "EUC-JP" another Japanese encoding. Other choices also are possible.)
[For more information about HTML, you might try the primer, HTML Basics, from the Austin Community College, Austin, Texas.
In order to make an HTML document accessible over the World Wide Web, you need to place the document in a directory that can be read by a Web server. For CS 199, WITS has created such a directory:
For Mac computers in Ford 202, follow these instructions:
Click on the "Finder". When the word "Finder" appears at the top of the screen,
smb://cs-199.willamette.edu/www
where you type your Willamette login name in place of yourusername.
With this connection established, load the following page into your browser:
http://www.walker.cs.grinnell.edu/courses/199.sp19-willamette/labs/sample-html-page.html
Then use the Save option in your browser to store the file to your Desktop (or other convenient directory. Once saved, use your mouse to drag the file to the course's Web directory: smb://cs-199.willamette.edu/www . In saving the file, choose a file name that is unique to you (and your partner). This is a shared drive, so all students have access to all stored files. Don't clobber someone else's work by using a file name they have picked.
To create or edit a file, use TexTEdit to manage a document stored on your Desktop After your editing, save the document to your Desktop and copy the new version to smb://cs-199.willamette.edu/www.
Edit sample-html-page.html, trying some variations of the wording and some of the formatting tags described above. For example, change the heading of the document, and insert a line at the end that indicates the dates when this file was created and last updated.
After each modification, save the file and copy it to smb://cs-199.willamette.edu/www. Then use the reload button on your browser to check your revised version of sample-html-page.html .
Edit the file further, leaving out the initial < html > tag. Reload and describe what happens. Then reinsert this tag, and try omitting some closing elements, reload, and describe what happens.
At the start of the body of the Web page, add another header line <h2> This is my new title </h2>. Reload the page to see what happens.
Change the <h1> header near the top of the page to <h2>, <h3>, or <h4>. In each case, describe what happens. Do you see any progression in style or format from <h1> to <h2> to <h3> to <h4> ?
Change the second sentence in the introduction to a bold font by inserting the tag <b> before the start of the sentence and placing the closing tag </b> after the sentence.
Insert a "horizontal rule" tag <hr> between the first and second paragraphs of the page, and describe what happens.
|
created 16 December 2003 revised 28 November 2006 updated and expanded 13-15 January 2019 |
|