Revision [2095]

This is an old revision of WikkaMenus made by DarTar on 2009-09-02 11:43:31.

 

Menu Template Files

NOTE
This feature is available since:
WikkaWiki 1.2
 


Wikka 1.2 introduces support for menu templates as part of its new theme functionality. Menu template files can contain any kind of text, actions (including custom ones) or wiki markup and are stored in the config/ directory. Different menu items are separated by a new line.

Menu widgets (or "menulets") are the most obvious candidates to add content to menu templates. {{homepagelink}}, for example, creates a link to the wiki's homepage, {{editlink}} creates a link to edit the current page (if the user has sufficient privileges to do so) and so on.

By default two menu templates are bundled with Wikka, main_menu and options_menu.

Default menu templates


main_menu.inc

main_menu controls the content of the main navigation bar, with links to the most important pages and functionality of the wiki.

[[CategoryCategory | Categories]]
PageIndex
RecentChanges
RecentlyCommented
[[UserSettings | Login/Register]]
Your hostname is {{whoami}}
{{searchform}}


options_menu.inc

options_menu controls the content of the footer toolbar, with links to a variety of handlers.

{{editlink}}
{{historylink}}
{{revisionlink}}
{{ownerlink}}


ACL and menu templates


Menu template files containing the .user and .admin suffix are loaded when the current user is a registered user or an admin, respectively.
This allows you to control the different kinds of content displayed to different users as a function of their privileges.

Creating custom menus


You can create an unlimited number of custom menus and navigation bars by storing the corresponding templates in the config/ folder. Menu templates are loaded via the MakeMenu() method. MakeMenu() takes as an argument the name of the template file (without suffixes), e.g.:

templates/default/header.php (line 59)
  1. <?php echo $this->MakeMenu('main_menu'); ?>


MakeMenu() automatically takes care of displaying the correct template files as a function of the privileges of the current user, so you don't need to use an ACL test when using it in a theme. The output of MakeMenu() is an unordered list using the menu template name as an id (which can be used to style/position the menu via the stylesheet), e.g.:

<ul id="main_menu">
<li><a class="" href="http://testme/wikka/1.2/wikka.php?wakka=CategoryCategory">Categories</a></li>
<li><a class="" href="http://testme/wikka/1.2/wikka.php?wakka=PageIndex">PageIndex</a></li>
<li><a class="" href="http://testme/wikka/1.2/wikka.php?wakka=RecentChanges">RecentChanges</a></li>
<li><a class="" href="http://testme/wikka/1.2/wikka.php?wakka=RecentlyCommented">RecentlyCommented</a></li>
<li><a class="" href="http://testme/wikka/1.2/wikka.php?wakka=UserSettings">Login/Register</a></li>
<li>Your hostname is <tt>wakka</tt></li>
<li><form action="http://testme/wikka/1.2/wikka.php?wakka=TextSearch" id="form_c2b696fff2">
<fieldset class="hidden">
    <input type="hidden" name="wakka" value="TextSearch" />
</fieldset>
<label for="searchbox">Search: </label><input id="searchbox" name="phrase" size="15" class="searchbox" /></form>
</li>
</ul>



Before Wikka 1.2, menu settings were stored in the config file as navigation_links and logged_in_navigation_links. As of 1.2 these settings are obsolete: when upgrading to 1.2, the installer will attempt to parse the existing menu configuration and write it to the corresponding menu template files. The server must have write access to the config/ folder to be able to perform this operation.


CategoryEN
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki