Look at also other topic groups, which I have done!
You can return to this topic group by using this menu and the link Table of topic groups in the top of the page.
Table of topic groupsFront page of mixed information technology pagesMixed > Dynamic structure with PHP (introsection)

Dynamic structure with PHP


I have divided this page into sections, which handle following topics:

The content as a one big page


It is always reasonable to define presentational details with CSS. It is also possible with CSS to separate at some level presentation and contents from each others. Ordinary Web-documents have always necessary structural parts, which don't belong to the actual contents. Basic navigation elements don't belong to the actual content. It is however possible to divide page into fragments, which the server builds an entire document.

PHP is one possible server-side language to do this. PHP was originally known as Personal Home Page Tools by by Rasmus Lerdorf. PHP is a HTML-embedded scripting language. Much of its syntax is borrowed from C and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

Below is a list of some such common features with other programming languages, which are important in order to understand examples, which I have in this page:

PHP-encoding has been separated from the other content usually with <?php + ?> or <? + ?> tags (at least in XML-document should use the longer format). Also Microsoft's ASP (= Active Server Pages) style tags (<% + %> & <%= + %>). Even if the file would not have anything else than PHP-encoding, PHP must be enclosed with PHP-tags. PHP can be run in all most used server applications.

Servers must identify pages, which use PHP. That's why the final pages must use certain file extension. In general servers has been defined so that they interpret *.php, *.php3, *.php4 and *.phml files as files, which need the PHP-parser.

Server and editor-specific notes:

  1. In principle it is also possible to use <style language="php">...</style> style tage, but they might cause difficulties for editors because they don't necessary interpret them as PHP-tags.
  2. Many servers don't support as default ASP-style tags. If they are intended to use, the support must ask from the webmaster of the server. The function phpinfo() informs the setting of the server.
  3. If other than the file extension .php has been used supported file extensions must check from the administrator of the used server or they must be tested before wide usage. At least in Apache-server supported file extension has been defined in the configuration file of the server. File extensions php3, php4 and phtml are such that they are not recommend to use because they are deprecated file extensions.

If files, which use PHP have been used as embedded in pages, which use PHP, the file extensions of embedded files can be set freely. These kind of pages could be called as "slave documents", which are never used as stand alone but always as particles of other Web documents. Pages which visitors see in the Internet could then be called as "master pages". The common habit is to use for slave documents the inc prefix (for example includeTop.inc).

Thinking about the download time of Web-page server-side scripts have advantages and disadvantages. The are good for slow computers because the server run scripts. In the other in fast computers and busy servers scripts, which are executed by the browser might work faster. In general server-side script are more reliable and it is necessary to think differences of browsers.

For me PHP is free with basic tasks. For many amateurs PHP is the only possibility to create cheap relative dynamic pages. If I would use databases I should page extra charge. I have experimented database-based Web-designing in my own computer. I try to apply the basic ideas of database-based Web-designing. I don't handle PHP very thoroughly. Understanding of examples in this page might need to read thorough PHP guides. I have learned most features from the PHP Manual, which is edited by Stig Sæther Bakken.

PHP: Download documentation.