Ken Pooley wrote:
>
> Q. Where does this code-init come from? How do I use it? (In my experience
> we don't really talk much about this element but it seems pretty key)
Each application requires some definitions for doing different parts of work.
<[code-init]>, <[code-compat]>, <[code-global]> are suggested names for
initialization, compability and global definitions in PHP code being generated by
Midgard during page composition process respectively. We used this names because we
need some naming anyway. If you look into midgard-root.php3 file you'll find that
these elements are called before calling another element with name 'ROOT' (which is
also part of name convention).
We supposed that
-- code-init element will contain initialization code such as parsing query
parameters, initialize internal structures used on the page and so on.
-- code-compat element will contain code that should be deleted in the future
versions of page but still used for achieving compability between old code and new
one.
-- code-global element will contain definitions for global variables, functions and
so on, possibly re-usable on all pages of the site.
Though Midgard itself has no internal dependencies on these names (except for
midgard-root.php3 which could be edited, of course, and Admin Site which uses 'ROOT'
element for displaying style elements hierarchy) we suggest to use this naming
scheme.
> Q. How do I know when to make a page or page element active?
You can make page active if you want: a) pretify URIs by passing parameters as a part
of path (i.e. /page/foo/bar/12345.html instead of
/page/?var1=foo&var2=bar&var3=12345), b) make your pages distinguishable for search
engines because many of them can't understand that /page/?var=foo and /page/?var=bar
are different pages.
There is no 'active' page elements. Instead, page element could be marked as
'inheritable' (inherited in the current Admin Site) and it will be inherited by pages
which lay in depper in page hierarchy than current page. It could be used for more
flexible control of page content (for example, you could define page element named
'banner zone', make it inheritable and redefine with empty content on the pages where
you don't what to place banners).
> Q. What is argv? Why does it return things to me?
$argv[] is an array which contains values passed to active page as path. For example,
if you have page named 'page' and it is active, then URI /page/foo/bar/12345.html
will be automatically translated by Midgard into values in $argv[] as
$argv[0] = 'foo';
$argv[1] = 'bar';
$argv[2] = '12345'; // Midgard automatically strips '.html'
And variable $argc will contain number of passed parameters (3 in this case). This
behaviour very similar to C programming.
--
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 sinking ship gathers no moss.
-- Donald Kaul
--
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]