UserGuide: Creating navigation menus

Difference between revisions from 2009/08/09 23:12 and 2009/07/23 22:19.
{include:subpage syntax}
'''Although this is still possible, [Menu plugin|UserGuide: Menu plugin] offers much easier way to create navigation menus.'''

Navigation menus are quite advanced topic in LionWiki because you'll need to know [Subpage mechanism|UserGuide: Subpages] and probably little bit of HTML too.

There are two ways to create menu. Common for both of them is that you need to create a page and write your desired menu in it.

In short:

* When using first way, you modify template file so the navigation menu is placed on every page.
* When using second way, you must add ''include'' tag into every page where you want navigation menu.

!I want one menu in every single page
Probably the best way to do this is to include your menu into HTML template (e.g. template_dandelion.html).

Again, we have two ways:
# create page (called e.g. "myMenu") and write menu in it and then put ^{include:myMenu} into the template on the right position.
# just write actual menu right into the template file

Page must be in HTML, not in LionWiki syntax. Because it is necessity, you can but don't have to enclose it in ^{html} tag. 

The first way has obvious advantage in that you don't have to connect to your FTP if you want to edit menu, you can do it easily within your browser. On the other hand, second way is more simple and straightforward.

!I want different menus in different pages
This is a little bit more complicated but added complexity gives you more freedom :)

So, first thing you need to do is to create page(s), write menu(s) in it and save it. In this case, you can use both HTML and LionWiki syntax. However, you'll probably want to write menu in HTML as menu should have distinctive appearance, should be floating on the right or whatever ...

Let's see example of such "menu page":

<div class="tagCloud" style="width:auto;padding-bottom:0px;">
<b style="font-variant:small-caps;">Navigation</b><br />
<ul style="padding-left:20px;">
  <li><a title="Basic information, news" href="?page=&amp;action=">Home</a></li>
  <li><a title="Installation" href="?page=UserGuide:+Installation">Installation</a></li>
  <li><a title="Graphic templates" href="?page=Appearance">Appearance</a></li>
  <li><a title="User guide to LionWiki" href="?page=UserGuide">UserGuide</a></li>
  <li><a title="Syntax reference" href="?page=Syntax+reference">Syntax</a></li>
  <li><a title="Discussion board" href="/forum/">Forum</a></li>
^{/html} }}

Notice that menu is enclosed with ^{html} tag.

Or, as I said earlier, it can be in LionWiki syntax:

{{* [Home]
* [Appearance]
** [Templates]
* [Help]}}

But this doesn't look very cool.

!!Including subpage in pages
Last thing you need to do is to include the page in every page you want it to be in, syntax is like this:

{{^{include:myMenu} }}

And that's it.

{tags:subpages, syntax, userguide}