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.

since 1.2
By default two menu templates are bundled with Wikka, main_menu and options_menu.
since 1.3
Several new menu templates have been added (see below).

Default menu templates


since 1.2

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}}


since 1.3

dashboard.admin.inc

This menu generates an admin toolbar in the upper right corner, visible to administrators only:

 (image: http://docs.wikkawiki.org/WikkaMenus/files.xml?action=download&file=dashboard_admin_inc.png)

AdminUsers
AdminPages
SysInfo
WikkaConfig


main_menu.admin.inc

Generated navlinks in header for administrators (right below the page title):

 (image: http://docs.wikkawiki.org/WikkaMenus/files.xml?action=download&file=main_menu_admin_inc.png)

[[CategoryCategory | Categories]]
PageIndex
RecentChanges
RecentlyCommented
[[UserSettings | Settings]]
You are {{whoami}}
{{searchform}}
{{logout}}


main_menu.user.inc

Generated navlinks in header for non-admin users (right below the page title).

[[CategoryCategory | Categories]]
PageIndex
RecentChanges
RecentlyCommented
[[UserSettings | Settings]]
You are {{whoami}}
{{searchform}}
{{logout}}


main_menu.inc

Generate navlinks for anonymous users (right below the page title).

[[CategoryCategory | Categories]]
PageIndex
RecentChanges
RecentlyCommented
[[UserSettings | Login/Register]]
{{searchform}}


options_menu.admin.inc

Generate action links in footer for administrators only:

 (image: http://docs.wikkawiki.org/WikkaMenus/files.xml?action=download&file=options_menu_admin_inc.png)

{{editlink}}
{{revertlink}}
{{deletelink}}
{{clonelink}}
{{historylink}}
{{revisionlink}}
{{ownerlink}}
{{referrerslink}}


options_menu.user.inc

Generate action links in footer for non-admin users.

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


options_menu.inc

Generate action links in footer for anonymous users.

{{editlink}}
{{historylink}}
{{revisionlink}}
{{ownerlink}}
Your hostname is {{whoami}}


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.

Please make sure that the server has write access to a folder named uploads.



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