Francois Dumais wrote:

> > > Root page :  There is a "content" field.  I saw from VMUC that it
> contains
> > > code (I mean Midgard code).
>
> What does one put here?  HTML or code?  If code, in what order is the code
> executed if there are page elements + style elements associated?

You can put whatever you like in there, although Midgard assumes it's
HTML by default. So if you want a script there, you have to start with
   <?

code-init and code-global are included first (see your rootpage), then
the ROOT element is included. The page will start building from there.
As for style/page elements: page elements override inherited page
elements, which in turn override style elements.

> Where is the entry point to start executing this code??  Does it start ONLY
> when it's called by the "content" code?  What is the sequencing?

The content is not actually mandatory. As you'll see in the midgard-root
file, there's an inclusion of code-global, code-init and ROOT. Those are
the entry points. Usually, a style will define ROOT, which will include
other elements to build a style. The style may eventually include
<[content]>, which will be replaced by the page content, but it doesn't
technically have to.

> What are the rules that govern the execution of this code?

None. If you want it executed you will have to include provisions in
your style to do it.

> Can we write
> HTML or Midgard code here?

Yes.

> Or just plain text??

Yes.

> In what sequence, with respect to the other code, will this code be
> executed

Where you happen to include it, or not at all (by default)

> and with what scope??

Global. Everything is global.

> What are the rules that govern the type of content there may be?

None.

> Can we
> write HTML or Midgard code here?

Yes.

> Or just plain text??

Yes.

> In what sequence,
> with respect to the other code, will this code be executed and with what
> scope??

Same as for the code field of topics: wherever you happen to include it.
Having code in articles is less common, though. It's usually just
included as content.

> > These page elements are called caused they are in midgard-root file.
> > You may also define there all pages structure.
>
> In what case does one need this?

For example to drive setting of headers or HEAD elements. With code-init
and code-global, you can include bits of code that will be executed
before the style building begins. What I use sometimes, for example:

Very simplistic style:
   <HTML>
      <HEAD>
         <TITLE>
            <? if ($context->title != '') { echo $context->title; } else { ?>
               <[title]>
            ?>
         </TITLE>
      </HEAD>
      <BODY>
         <[content]>
      </BODY>
   <HTML>

And then a page could have a page element code-init which does:

<? $context->title = "This is a dynamic title for page " . $midgard->page; ?>

> > > When looking at a given "style" or in "page elements", one often sees
> > > <[author]>, <[content]>, <(content)>, <(title)>,<[title]>.  How do use
> them?
> > > What "content", "title", "author" are they referring to?  The "article"
> or
> > > something following "initialization" ?

<[tagname]> and <(tagname)> are the same. <[content]> and <[title]> are
somewhat special, in that unless overridden they default to the content
and title of the page that is being accessed. The rest must be defined
in styles or as page elements or will be silently ignored.

> I understand this, but what is the sequence of execution?  Does it follow a
> certain order of execution, where is the entry point?

The entry point is ROOT. Everything build hierarchically from there.

> > Mostly code is putted to pages, styles.
>
> Mostly?  But can we put elsewhere?

Sure. But only stuff that is in styles is executed without aid. The
other stuff you'd either have to eval, or include as &(varname:p);

Emile


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to