>> SPEAKER: Suppose that we'd like to create a home page for a course that
provides students with links to resources.
How might we do it?
Well, let me propose this very simple example.
>> Here, we have the course's name, CS50, below which is an ordered list, one
with a link to lectures, and one with a link to the syllabus.
If I click now on lectures, I see another unordered list, this time with
a link to Week 0, and another link to Week 1.
If I choose Week 0, for instance, I'll now see that we have links to
Wednesday and links to Friday.
And if I dive in one level deeper, this is CS50.
>> Now, how might we go about implementing the site in code?
Well, let's take a look.
Here, in index.php, allow me to propose not even PHP
code, but simply HTML.
In particular, there's that unordered list inside of which
are two list items.
>> If we now look at lectures.php, to which the first of those bullets
linked, we now see that second unordered list, this one with links to
Week 0 and Week 1.
And we take a look at week0.php, to which that first bullet links, here we
see, again, an unordered list, this time with a link to Wednesday's
slides, and another link to Friday's slides.
And in Week 1 is very similar code.
>> Now across all four of these files is quite a bit of redundancy.
In particular, each of them has an HTML tag, a head tag, a title tag, and
the title CS50.
Each of them has a body and an H1 tag, inside of which is, again, CS50.
And beneath that is an unordered list again and again.
Surely it would be nice if we could somehow factor out those commonalities
into some central place so that, if I ever want to change my page's
structure or even its title, I could do it much more easily.