Below is the code for generate automatic menu of a website. I hope it will
help some people like me who are new with Midgard and Nadmin. Because I
tried Nadmin's automatic menu generation and it did not work for me.

As Henri said it only works for one level of pages directly below the root
page. The basic idea I did this is that to embed this menu function in
style and all the pages generated will automatically have menu for the
website.


<? $midgard = mgd_get_midgard();
   $host = mgd_get_host($midgard->host);
   $root_page = mgd_get_page($host->root);
   if ($page_list = mgd_list_pages($root_page->id)) {
     while ($page_list->fetch()) { ?>

          <p><a href="&(host.prefix);/&(page_list.name:u);/">
&(page_list.title);</a></p>

<?   }
   } ?>


Rene


Hello Rene!

I'm not entirely sure what kind of menu you wish to implement.
But... the piece of code below will execute as long as there
is pages "above" you. If you have only one (root) page,
only that page will show.

If you wish to create a dynamic menu that lists all your
page records (which is not so common since most people are
using topics and articles to generate menus) you could
do the following:

<? $midgard = mgd_get_midgard();
   $host = mgd_get_host($midgard->host);
   $root_page = mgd_get_page($host->root);
   if ($page_list = mgd_list_pages($root_page->id)) {
     while ($page_list->fetch()) { ?>

          <p><a href="/&(page_list.name:u);/">&(page_list.title);</a></p>

<?   }
   } ?>


NOTE!!! That code will only take into account ONE level of pages
directly below the root page. If you wish to list everything under
everything ;)  you should create a function that does the job.

NOTE2!!! I haven't tested the code above or used it anywhere
so there might be typing/spelling errors etc...

Right, hope this helps, I'm not too much of a coder myself.
You should take a look at the user-list archives at:
http://marc.theaimsgroup.com/?l=midgard-user&r=1&w=2

I suppose there could be some ready made functions that take
care of dynamic menu generation.

Happy coding!

  //Henri Kaukola

CONFIDENTIALITY : This e-mail and any attachments are confidential and may
be privileged. If you are not a named recipient, please notify the sender
immediately and do not open any attachments hereto, disclose the contents
of this e-mail or the attachments if any thereto, to another person, use it
for any purpose or store or copy the information in any medium.


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

Reply via email to