Difference between revisions of "Week Five Exercises (MGDP2060)"
From Wiki @ Karl Jones dot com
Karl Jones (Talk | contribs) (Created page with "This article contains exercises for '''Week Five (MGDP2060)'''. This exercise demonstrates * The include statement * The header statement == Create folder == == Create...") |
Karl Jones (Talk | contribs) |
||
Line 44: | Line 44: | ||
In <code>index.php</code>, enter the <code>include</code> statement twice, once each for header and footer, like this: | In <code>index.php</code>, enter the <code>include</code> statement twice, once each for header and footer, like this: | ||
− | ... | + | <code><nowiki> |
+ | <?php | ||
+ | include ("header.php"); | ||
+ | ?> | ||
+ | </code></nowiki> | ||
+ | |||
+ | And: | ||
+ | |||
+ | <code><nowiki> | ||
+ | <?php | ||
+ | include ("footer.php"); | ||
+ | ?> | ||
+ | </code></nowiki> | ||
+ | |||
+ | See: | ||
+ | |||
+ | http://php.net/manual/en/function.include.php | ||
== Reading == | == Reading == |
Revision as of 15:26, 24 September 2015
This article contains exercises for Week Five (MGDP2060).
This exercise demonstrates
- The include statement
- The header statement
Contents
Create folder
Create web page
In this exercise folder, create a web page named index.php.
Follow the web page standards.
In this folder, create two new documents, named:
-
header.php
-
footer.php
Cut the upper portion of the HTML from index.php, and paste it in header.php.
- Which part to cut: Everything from the first line, through at least the
<body>
, and then some more- How much more varies from case to case
- Use
header.php
for the HTML which will (in later exercises) be shared between multiple different pages - Put your name in the header.php
header.php
, because this is shared content across pages - Keep the exercise title (the words "Week Five Exercise", or whatever) in
index.php
, because that content is specific to a single page
footer.php
works much the same.
Cut the last part of index.php
, and paste it in footer.php
.
- This always varies from case to case
- Always put the closing tags for body and html in the
footer.php
. - Put copyright statements and similar information in
footer.php
- If you use the
footer
element (see Semantic HTML), it goes infooter.php
- Always put the closing tags for body and html in the
include statement
In index.php
, enter the include
statement twice, once each for header and footer, like this:
<?php
include ("header.php");
?>
</code>
And:
<code> <?php include ("footer.php"); ?> </code>
See:
http://php.net/manual/en/function.include.php
Reading
Textbook reading for next week: Chapter Thirteen.