Dynamic Page Generation
Content Generation Of Data Stored In A Database
With Maxscape content and applications can be stored in a rational database and then be dynamically generated by the content generation engine of the application server's runtime system. Content can be, whatever you want it to be. Plain text, XML, HTML, HTML with embedded variables and (member) function calls, Perl scripts, you name it. You even can put images and binary content into the database, which mostly doesn't make to much of sense.
At first, which was in the beginning of the nineties, it felt quite weird to do just that. Having written my first program on an IBM card reader computer and being accustomed to Pascal, C and C++, Perl was a big relief in many ways. One advantage is the Perl's 'eval' function. Simply define a string that contains embedded variables and function calls, store it in a database and then evaluate it in the appropriate context and that's it!
$TextWithEmbeddedVariable = 'Variable = $EmbeddedVariable;'; $Text = $Page->evalText ( $TextWithEmbeddedVariable );
This cannot easily be done with compiler languages. One would have to write another (Perl) interpreter. At the end of the day, this feature is a perfect interpreter of text with embedded software on its own! This makes it easy to store code in a database table field and let it be executed by the server's runtime system.
Storing content in a database, opens a whole new world of possibilities. Whereas file systems are sorted in a hierarchically manner, rational databases work with n-dimensional tables. Therefor Maxscape maps the hierarchical view of an HTTP daemon to the application server's content database. If, for example, to make a content depending on a language to be displayed, simply add a 'LANGUAGE' column to the database 'PAGE' table. The content generation function can now take care to display the text in the choosen language, depending on a CGI variables. Whether application code is stored in a file or the content database is now at your choise, indeed. Generally, it is good to store the design, plain and HTML texts, as well as script snippets in the content database and the more generic code in a file. A content generation function can then take care of the assignment of the storage location to a client's request.
Content Generation with Maxscape
A HTTP daemon like the Apache can deliver files on its own. Of course, Maxscape does not void this feature. The generic server platform works fine without the Maxscape library. Though, it might be a good idea to be cohered. Exceptions poof the rule.
All the same, Maxscape suggests to store application software firstly in the content database. If it turns out that an application function might be generic, it can be moved to an appropriate modules file of the application server or even the the Maxscape library, later. Obviously, a content database approach introduces features like:
- Hierarchical content structure with inherited category properties
- Document Decomposition into pages, templates and elements
- Nested templates and interlaced elements
- Arbitrary import of template and page elements
- Callbacks on category, page and templates elements
- Content with embedded software variables and function calls
Hierarchical Content Database Structure
The data model implements a hierarchical view on the content structure. Like in a file approach, pages are structured in a hierarchical page tree, whereas pages compares to files and categories to directories. The CGI variables 'Page' and 'Category' are used to address a location. So:
is the Maxscape equivalent to:
of the file addressing scheme. While the later points to a file, the former addresses table fields in the database. This introduces features that are much harder to achieve, when using only a file system structured by directories, and where files are the smallest storage unit. Though a category compares to a directory, it has much more possibilities. For example, if you want to inherit a property to a complete site, simply create a root category element, define a variable and let the content generation function import this category element in all the site's pages.
To map client requests to locations in the content database, an object oriented data model is applied. It allows to store content and server side scripts in a relational database and content is then generated by generation functions, thus hiding and encapsulating details to application programs. Server features can be used in applications, via the Maxscape application programming interface (API). The API classes are implementing the database queries and other tasks.
- separate content from layout
- separate dynamic from static elements
- define generic elements
- reuse already defined elements
- define your own language
- inherit properties and functions
- reduce complexity and redundancy
- map elements to objects and callbacks
- individualize pages
- support multi languages
The system implements a sophisticated template technique. Templates are used to implement layouts or features, which are common to several pages or page parts, thus reducing redundancy and administration effort. Global templates may be defined, to generalize common properties of a template type. Like pages, templates are composed of elements, which can be inserted into each other. Within template elements API functions are then called, in order to embedded page elements or vice versa.
Application Modules, Callbacks and Plugin Mechanism
Applications are layered on top of the server software, using the Maxscape API. They are either embedded in the content or plugged in via the callback and plugin mechanism.