Arne Schirmacher wrote:
> 
> Hi all,
> 
> my biggest problem as a new midgard 1.4 user is:
> 
> I don't really understand the concept behind it and I could not find a document
> describing it. In particular, I don't know what of the features is PHP and what
> is midgard.
> 
> My current understanding of how it works is:
> 
> For every page hit, midgard has the midgard-root.php3 document and the URL.
> 
> 1. It finds the page document corresponding to the URL.
> 
> 2. It finds the style associating with this document.
> 
> 3. The style contains macro blocks of the form <[name]>, which can contain HTML
> or PHP code or other <[name]> macros. Midgard collects references to these
> blocks. If a style is a child style, then also the macros of its parent style
> are collected, and so on up to the top.
> 
> 4. Midgard then replaces the <[name]> macros in the midgard-root.php3 with the
> actual text. The midgard-root.php3 has one <[ROOT]> macro, therefore every page
> must have at least one style with a <[ROOT]> macro, otherwise we would have no
> HTML text at all.
> 
> 5. Following that Midgard replaces any macro of the form <(content)> with the
> content of the field named "content" of the page object found in step 1
> 
> 6. The resulting HTML/PHP mix is then fed to Apache, which takes care of the
> rest.
> 
> Ok, so far I understand the thing. Now here are the unanswered questions:
> 
> What are the <(name)> macros? It looks as if these are fields of a midgard
There is no difference between <(foo)> and <[foo]>, both forms are valid now,
latter is preferred while former was added because Finnish keyboards had
problems with latter form.

> object, but is it always from the Page object or can it be another object like
> Article, Style, Topic? If the $object->name field is emtpy, will midgard look
> for this variable in other objects?
Midgard (mod_midgard in fact) automatically fills three elements: 'author' with
the name of the page author, 'title' with the page title, and 'content' with the
page content. It means that you can consider them as pseudo-elements. There is
no way to fill out such information based on other objects because mod_midgard
deals only with host, page, and applied style (with style elements, possibly
overridden by page elements).

> Which of these <(name)> macros are available? Or can I simply use all fields 
> of a particular object?
As I said, there are 'author', 'title', and 'content' of the page being executed
available as pseudo-elements.

> How do page elements fit in this model? I noticed that macros of the form
> <[page-element-name]> reference the code in the page element when used in a
> style, just like other style elements, but what is the purpose? What are the
> differences?
The purpose of the page elements is to override behaviour of the style applied
to the page. There is no difference between page and style elements for the
Midgard/PHP parser because all elements needed to produce page are put into
special array (name, value) during mod_midgard work phase which is used later by
Midgard/PHP. This array has no information about nature of its elements.

What is really important, that page elements can be marked as inhertable which
allows their propagation further on site structure. It means that you can
override style element somewhere at the upper level of your site and then use
this page element in all pages below by marking it as inheritable.
 
> One last question: Can I set the style for a page dynamically somehow? I have
> an active page of the form /topic/, which uses one style, and the pages of the
> form /topic/article123.html should use another style. Currently I have merged
> both styles into one style document and I select the appropiate one with an "if
> ($flag) {" construction, but this does not feel right. I would rather like to
> set the style explicitely in the piece of code where I handle the argv[]
> arguments.
This is not possible because mod_midgard is responsible for applying style to
the page (i.e. filling an array of used elements) and _it_ should know what
style must be applied. Due general nature of mod_midgard, there is no code in it
which could select style depending on request.

-- 
Sincerely yours, Alexander Bokovoy 
//   The Midgard Project   // Minsk Linux Users Group // IPLabs Linux Team
\\ www.midgard-project.org \\   www.minsk-lug.net     \\  linux.iplabs.ru
A plucked goose doesn't lay golden eggs.

--
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