DropDownMenu

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Dropdown menu listing all Wiki-Pages for quick navigation.

Solution

Attach:quicknav.php

Discussion

Download the php file Attach:quicknav.php and put it in your local/ directory. Add the following lines to your local.php file:

 include_once('local/quicknav.php');
 $GLOBALS['QuickNav'] = build_quicknav();

You may now use $QuickNav in your page templates to get the dropdown menu. Note that the HTML code produced by quicknav.php does not include form-tags, so you have to add them in the template file. I personally use one form element conatining both the dropdown and the search field:

 <form action="$ScriptUrl/Main/SearchWiki">
  $QuickNav &bull;
  <input id="wikisearchbox" type="text" name="text"> 
  <input id="wikisearchbutton" type="submit" value="Search" name="submit">
 </form>

If you want to customize the list of ingored pages and group, see the variables $ignore_groups and $ignore_pages at the beginning of quicknav.php.

See Also

The php code for listing all pages was inspired by the code used for IndexTemplate.

History

Comments & Bugs

  • I'm wondering why, when I use the Cookbook.WikiFarm variety of farm, I see WikiFarm twice in the list. Is there something about the lookup process that repeats the entry? --Profiles/JamesCarlson

Contributors

  • noniq - initial file (2004-05-25)

pmwiki-2.2.120 -- Last modified by {{JamesCarlson}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons