إعلانيمكن أن تكون علامتك التجارية هناعلامتك التجارية هنافي كل صفحة من Darslab · طلاب وأولياء أمور ومعلمونinfo@darslab.comاسأل عن الأسعارالأسعارinfo@darslab.com
☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Links, visual editors and the header page

الأسبوع 9 · الوحدة ٣ «إنشاء صفحات الموقع» (٢) الموضوع الأول (تابع): الربط بين الصفحات، كتابة الكود أو استخدام محرر مرئي، صفحة الترويسة بالشعار والقائمة · 3 دروس
3

The header page: banner and menu

ICT Secondary 2 Term 1, Unit 3, Topic 1: pp. 69–77
GoalWrite the header page: a banner picture and a menu of six links.
New words
header page · the file header.php, which holds the banner and the menu and is included at the top of every pagedivision (div) · a tag that groups a block of a page so it can be handled togetherbanner · the picture across the top, here with a set width and heightnon-breaking space · a space written   that the browser never turns into a line break
Explanation

The header page is written once and shown on every page. It has two divisions. The first holds the banner: an img tag with a width and a height so that it always takes the same space. The second holds the menu: the six links Main, Add, Search, Edit, Delete and Help, each pointing to one of the site’s files. The links need some space between them. A browser squeezes ordinary spaces together, so the book separates the links with  , a non-breaking space. It works, but it is a crude trick: styling rules (CSS) give cleaner, adjustable spacing, and you will meet them later. Remember Week 4: every page includes this file with one line, so a change to the menu is made in one place. Note that header.php holds only these two divisions; the page that includes it keeps its own html, head and body tags.

Html
1<div>
2<img src="images/banner.webp" alt="Illustrated Dictionary banner" width="600" height="120">
3</div>
4<div>
5<a href="index.php">Main</a> &nbsp;
6<a href="add_term.php">Add</a> &nbsp;
7<a href="search_term.php">Search</a> &nbsp;
8<a href="edit_term.php">Edit</a> &nbsp;
9<a href="del_term.php">Delete</a> &nbsp;
10<a href="help.php">Help</a>
11</div>
Output
The page shows the banner picture, 600 wide and 120 high, and under it one row of six links: Main, Add, Search, Edit, Delete, Help.
Worked examples
Menu wordFile it opens
Mainindex.php
Addadd_term.php
Searchsearch_term.php
Editedit_term.php
Deletedel_term.php
Helphelp.php
Each menu word has one file. Check that every link names a file from the plan of Week 4.
Html
1<body>
2<?php include("header.php"); ?>
3<h2>Help</h2>
4</body>
Output
The visitor sees the banner, then the six links, then the heading Help.
Trace what the visitor gets. In help.php the include line is right under the opening body tag. The server puts the header’s banner and links in that place, so the visitor sees them first and then the heading Help.
Class activity

Write on paper the two divisions of a header for the reading-club site (a banner and four links: Home, Books, Members, Contact). Give the files they open, then say in one sentence why the links live in one file.

Practice
1
What two things does the header page hold?
2
Why does the img tag in the header have a width and a height?
3
What is &nbsp; and why is it only a crude trick for spacing?
4
Which file does the link Delete open?