|
|||||||||
|
Putting It All Together
To use the PHP functions described above and otherwise make the inheritance system work, you will need to add a standard include file to each page. This standard include file sets up the basic inheritance system, loads default settings, loads other libraries you expect to use on every page, and loads placeholders you can use elsewhere to override or enhance the default settings. While not strictly necessary, using a standard include file such as the one in this article's downloadable code adds power and flexibility to the OO file system. You will also find details and source to a small working site in the sample code.
You could specifically add a standard include file by writing the code to load it at the top of each page, or add it generically by writing the code at the top of each header template. The included code demonstrates both methods. Despite the extra line per file, it's useful to put the include line in each page, because you can then modify the defaults before the page template starts to display. Simply put this at the top of each page:
Then, between this line and the line to include the page header, you can change variables used by the header, and otherwise modify the style before it begins to display. You'd typically use such modifications to set the page title, or set other parameters used by the main template.Extras You'll find some small extras included with the source. These are not necessary to implement the OO file system, but you may find them useful. A brief description of each follows:
|
|||||||||
Scott Scriven is a freelance open-source hacker who enjoys dabbling in a wide variety of technologies, and creating beauty through simplicity. He strives, in all aspects of life, for three things: to learn, to love, and to play.
| |||||||||
|