The manual Page
Version française
   
index | glossary | news | downloads | links ]
  PHP home page
pages
guest book
news
print button
 
news
glossary
links
downloads
 
credits
contact
 
 
search
 
last update
19/02/2003
Valid HTML 4.0!
Valid CSS!
Hit-Parade
Mesurez votre audience


  Principle of PHP pages of this Web site

In a general way, a web site follows a look and feel charter. Therefore, nearly all pages will look the same and few things (apart from the content) will be different. This is the case of this site: all pages have a top banner, the TmP logo at the upper left corner, a menu on the left and a footer.

Finally, the goal is to ease the writing of Web pages. The principle is this one: cut-out pages into statical areas that are common to all pages:

Cut-out into statical areas

To do so, one writes a simple page, and one cuts out the HTML code into statical pieces. The corresponding portions of HTML code are written in different files, and that's all. This cut-out is often call template.

From then on, when we write a page, we just have to include these files as follow:

<? include("../include/file1.hmtl"); ?>

This site has a directory called /include in which are stored the 5 files of the template, and pages are written like this:

<!DOCTYPE HTML... >
<html>
<head>
...
</head>

<? include("include/top.hmtl"); ?>The manual Page<? include("include/hg.hmtl"); ?>
<? include("menu1.hmtl"); ?>
<? include("include/bg.hmtl"); ?>

<!-- Body -->
bla bla bla...

<? include("include/imprimable.hmtl"); ?>
<? include("include/footer.hmtl"); ?>

This cut-out make it easy to insert a different menu and title into each page.

The line include("include/imprimable.hmtl"); can be removed for pages that do not have a content worth being printed. print.html contains an image and a dynamic link to /utils/imprime.php3 (see the explanation for the "printable format" button).

this method is really simple and effective. We can set aside the extra HTML code of the page and focus on the relevant content. It is easier to write pages. We also gain place on the server (the extra portion of code is important) and time when we change the look and feel charter, since we just have to change template files.

Useful function

name description
include include the content of a file

printable format printable format



Copyright © 2000-2002 themanualpage.org - This site is submissive to the terms of the GNU GPL and FDL licences.