Website 3 - Add a Flat File Database

The following is an example of a website that uses a flat-file relational database to create dynamic pages. (Updates have been disabled for this demo.)

 basic 3-page website


The database is composed of text files grouped by table. For this application, there are two tables - 'pages' and 'blocks'. Blocks are sections of text and/or images that can be inserted into a web page.

Table records are defined in the inc/db-functions file, which also includes all the functions needed to read and write the records. To make this database relational, a set of 'maps' are provided in the data folder, that join the primary keys of these tables. There are also functions for reading and writing the maps.

When a web page is requested, these maps are used to assign blocks to corresponding page sections.

Top-level folder:

 top level file structure for NS-3

Admin folder:

 files in admin folder for NS-3

Data folder:

 files in data folder for NS-3

Inc folder:

 files in inc folder for NS-3


View Code
Top-level folder:
admin-pages folder:
data folder:
data/blocks folder:
data/pages folder:
data/page-templates folder:
dta/page-block-maps folder:
inc folder:





***