>> PROFESSOR HARLAN: HTML, or HyperText Markup Language, is the language in
which web pages are written.
Now, it's not a programming language, because it doesn't allow us to express
logic, like for loops, and while loops, and conditions and the like.
Rather, it's indeed a markup language that allows us to specify what a web
page should look like, structurally and aesthetically.
And it does so by way of what are called tags.
Let's dive in and make the simplest of web page, one that simply says, for
instance, hello world.
>> Notice here, in gedit, that I've already saved the file as hello.html.
And notice down here, in the terminal window, that I appear to be inside of
a directory called public, which itself is inside of a directory called
local host, which itself is inside of a directory called vhosts, which
itself is inside of John Harvard's home directory.
Now it turns out, because of the way we've configured the appliance, which
is in as real world a way as possible, anything inside of this public
directory should, indeed, be accessible to the whole public via a
web browser, even though, right now, I'm the only user who's going to be
accessing this web page.
>> Let's now return to hello.html and start writing some of that language.
First, atop this file, I'm going to specify open bracket, exclamation
point, DOCTYPE space html.
This line isn't a tag, per se, even though it does begin with an open
bracket, but it, instead, is a special one line fragment that specifies to a
browser, here comes a web page written in HTML.
>> Let's next, on a line of its own, specify open bracket html, indicating
to the browser that here, indeed, is that HTML.
Inside of that, let's indent a bit, and then do head, specifying to the
browser, here comes the head of the page, which, for now, assume is
essentially the title bar at the very top of the browser's window.
Let's next specify, inside of that head tag, that we'll have a title of
something simple like hello.
But now, let's tell the browser we're done providing a title.
To do that, just as we opened or started the tag, title, a moment ago,
let's now close or end that tag by specifying, in effect, the opposite.
>> To express that, we do open bracket, forward slash, title.
Similarly, now that we're done defining, for now, the head of this
page, we'll do open bracket slash head, telling the browser that we're
now done providing the head.
Only one portion now remains, the so-called body of the web page, which
really constitutes the essence of any web page.
>> Let's specify that, here, it's beginning, with open bracket, body,
close bracket.
And let's now write something like hello comma world.
Feels like this is a good enough web page, so let's now move to a new line.
Specify open bracket, forward slash, body, informing the browser that we're
done providing the body.
And similarly, let's now inform the browser that I'm done
providing a web page.
On a line of its own, we'll do open bracket, forward slash, html.
>> Now, notice the aesthetics of this web page.
Even though, technically, it's not required to provide as much white
space as I did, it's good style, because the code is, arguably, much
more readable.
Notice, in particular, that when I open or start a tag, I then indent in
the lines that follow.
And when I close or and the tag, I close that tag either on the same
line, if it's a fairly short line, or on a new line in such a way that the
close tag lines up with the open tag, much like we did in a language like C
with open and close curly braces.
>> Let's now save this file and try to open it in a web browser
inside of the appliance.
Let's open up Chrome, and let's now visit http://localhost, which is a
nickname for the appliance itself, /hello.html.
And notice that I've not actually typed public, because it's implied
that if visiting this page via a web browser, you indeed want to access the
contents of that public directory.
But I do want to access, specifically, hello.html.
So let's now hit Enter and see what happens.
>> Hm.
I don't have permission to access /hello.html on this server.
Now, why might that be?
Well, it turns out it's not sufficient to simply put this file, hello.html,
in that public directory.
We also need to proactively tell the appliance that we, indeed, want to
allow the whole world, potentially, to access this file.
To do so, we need to change its permissions, so to speak, and we can
do that at a command line.
>> Let's type ls -l to get a long listing of the files in this directory, Enter.
And we see, indeed, hello.html.
But over here on the left, notice, is an r and a w.
The r, as you might have guessed, means read, and the w means write, but
the fact there's only one such r and one such w, all the way over to the
left of those dashes, means that only the files owner, myself, can actually
read and write this file.
>> We need to toggle at least one other r to let the whole world read
this file as well.
And to do this, we can do so with the command, chmod, or change mode.
chmod a, for all, plus r, space, hello.html Enter.
Nothing seems to have happened, but that's generally a good thing.
So ls -l again should, hopefully, yield some additional r's.
>> And indeed, we do see such.
On the left-hand side here now, notice that I have read and write privileges.
There's another r, and then another r.
Well, it turns out the r in the middle means my group, which happens to be
students in the appliance, can also read this file.
But that's largely irrelevant here, since we're talking about the web and
not the appliance itself.
But that third r all the way on the right indicates that the whole world,
or all, can read this file.
>> Let's now go back to my browser, reload the page, and see if I'm no
longer forbidden.
Let's click Chrome's reload icon up here, or hit Control-R, and there we
have it, hello world.