|
Building Your Website With Cached Dynamic Modules
JP
In this article I will show how to use a modular system to create a website
that is constructed on the fly using dynamic modules, which for performance
sake can be cached if you want. Each module is a php script on its own, returning
html data to be included in the final html page.
Overview
- php scripted modules that implement functionality (e.g. a style definition, menu or discussion board)
- a parser that can construct the html page by reading input files, determining which modules to call and then combine output of the modules
- files with specific extension (say .my) that specifiy html + calling tags for each module
Walkthrough
To demonstrate how it works, let's see a file called hello.my:
<title>Hello world</title>
<my-style name=test>
hello world
If a request is being made for index.my, the webserver redirects
this request to the php parser, which just scans for <my- .. >
tags. It finds the 'style' tag, and looks for the module style.php in its module directory.
The file style.php is included and the function handle_style ($arglist)
is called, where $arglist is an associative array of all specified
parameters to the tag (here: ).
<?php $arglist[name] = "test"; ?>
The handle_style function must return a string containing html. How
the module determines the html doesn't concern the system. Say, the handle_style
module returns <font face=Arial size=2 color=yellow> and the parser
includes this in the final html.
[ Next Page ]
| Comments: | ||
| Could somone please tell this! | David Tandberg-Johansen | 10/05/02 08:50 |
| building a website | peter sims | 05/25/02 01:27 |
| urm, try this | nobody | 01/28/01 02:08 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


