Templates

The JavaScript connection

  • JavaScript files contain file paths, just like HTML files. The paths can be broken when you use PHP to insert library files.
  • You can fix the problem by creating a JavaScript variable in each file containing the path to the Web root. That variable is added to the JavaScript code in the library files.
  • The JavaScript variable can have its value set by PHP.

Web site templates

See more about:

Where are we?

Our first PHP task is an easy one, but one of the most important uses of PHP.

Most Web pages have regions, like this:

Web page regions

Figure 1. Web page regions

Different parts of a page are put into the regions:

Using the regions

Figure 2. Using the regions

All of the pages on a site usually have the same structure.

Site directory tree

Learn: * What a site directory tree is. * How to put files where Webers expect them to be. * How to create a directory tree that supports reuse.

Lessons

User login


Dogs