On 28 Oct, yvain wrote:
> It strikes me as being nicer if one could query where one is in the
> midgard page tree with a piece of php. This would mean that one could
> write a piece of code for the navbar that could work out where the user
> currently is, and show links to subpages under that section.
As pages in Midgard are not real pages, but rather just
database entries that Midgard maps to a directory-like tree
structure, they are quite aware of where they are and what
children or parent pages they have. Because of this, it
is very easy to write a simple PHP script for generating
the subpage links...
The variable for this is $midgard->page. You could use it
like the following in a page/style element:
<ul>
<?php if ($p = mgd_list_pages($midgard->page)) while ($p->fetch()): ?>
<li><a href="&(p.name);/">&(p.title);</a></li>
<?php endwhile; ?>
</ul>
...of course, you can also do much more elaborate dynamic
link structures with constructs like this if you want to.
> Chris
/Bergie
--
-- Henri Bergius -- +358 40 525 1334 -- [EMAIL PROTECTED] --
http://www.iki.fi/Henri.Bergius
--
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]