On Thu, 2 Mar 2000, anatol wrote:

> Thanks for the info - answers a pretty fast in this mailing list :-)
> 
> I'm trying to understand how the HTML-page-building-process works.
> Is there any visual description (perhaps a picture?) how midgard
> works from start of the page-building until end. 

I'm not much of an artist but if the following explanation makes any
sense to you by all means have a stab at it.

"In the beginning there was the HTTP request..."

The HTTP request carries 3 important pieces of information:
- The hostname
- The portnumber
- The URI within the host

For Midgard to decide if an HTTP request matches a host under its care,
the hostname must match exactly (case insensitive I believe), the
port number must match or the port number in the database must be
set to 0 (wildcard), the prefix defined in the database must match
the start of the URI, and the host must be marked online.

Even if you send no portnumber the browser will send 80 for you
by default. When multiple hosts exist with the same name Midgard
will pick the one with the most specific portnumber (in other words
the non-0 one) and the longest prefix match (which may be of zero
length).

Having picked a host, midgard will walk the rest of the URI (with the
leading prefix, if any, stripped off) to find the specific page
record requested.

Each page specifies an associated style, either explicitly or simply
indicating inheritance from its parent.

So what we have now is a page and a style.

Midgard starts processing the midgard-root.php3 which will include a
element named ROOT. The style must define ROOT (either explicitly
or inherited) or nothing will happen. The ROOT may (usually will)
itself reference other elements, which in turn, etc. Each element
referenced is replaced with the contents of said element until
all element references have been expanded.

Page elements take precedence over inherited page elements of the same name,
inherited page elements over style elements, style elements over
inherited style elements. Elements that are referenced but not
present are replaced with zero content.

We have at this point a fully decorated page with no actual content.
That's no good.

There are two 'magic' element names, <[title]> and <[content]> that
will automatically be replaced with the title and content of the current
page, so if you store content there it will be placed in the makeup
built by the style.

Another way to insert content is to actively generate this. This is
most often, although by no means necesarily exclusively, used with
so-called 'active pages'. Active pages and static pages are both active
in the sense that they're PHP scripts, but while a static page will
only be activated for requests that target its URI directly, active
pages service anything that targets its URI and beyond.  Everything
beyond the page URI is split on the slashes and passed to the script in
the argv array, so if /article is an active page than the script would
be passed the array ('about', 'you', 'and', 'me') when servicing
/article/about/you/and/me.html.

The script can use this information to gather information from the
topic trees or even external data; everything the script in the
page content prints out will turn up where <[content]> was referenced.

Actually, this explanation ain't half bad. Anyone care to work on
readability and run on sentences and put it in the manual?

Emile


--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to