=====Menu Template Files===== >>==See also:== ~- [[WikkaThemes | Installing themes]] ~- [[Menulets | Menu widgets]] >>{{since version="1.2" align="left"}}::c:: Wikka [[WhatsNew12 | 1.2]] introduces support for **menu templates** as part of its new [[WikkaMenus | theme functionality]]. Menu template files can contain any kind of text, [[UsingActions | actions]] (including [[InstallingPlugins | custom ones]]) or [[FormattingRules | wiki markup]] and are stored in the ##config/## directory. Different menu items are separated by a new line. **Menu widgets** (or "[[Menulets | 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 version="1.2" display="inline"}}By default two menu templates are bundled with Wikka, ##main_menu## and ##options_menu##. {{since version="1.3" display="inline"}}Several new menu templates have been added (see below). ====Default menu templates==== {{since version="1.2" display="inline"}} ===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 [[HandlerInfo | handlers]]. %% {{editlink}} {{historylink}} {{revisionlink}} {{ownerlink}} %% {{since version="1.3" display="inline"}} ===dashboard.admin.inc=== This menu generates an admin toolbar in the upper right corner, visible to administrators only: {{image src="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 src="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 src="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 [[ACLInfo | 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.: %%(php;59;templates/default/header.php) 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 [[ACLInfo | 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.: %%(html4strict) %% ==== Legacy navigation links (Wikka 1.1.X) ==== Before Wikka 1.2, menu settings were stored in the [[ConfigurationOptions | config file]] as ##navigation_links## and ##logged_in_navigation_links##. As of 1.2 these settings are obsolete: when [[Installing12 | 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. {{files}} ---- CategoryEN