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.5.9 -- Last modified by {{JamesCarlson}}

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

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2dV1%2fDropDownMenu
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2dV1%2fDropDownMenu
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook-V1/DropDownMenu
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook-V1/DropDownMenu
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afIks5MKBREdSxn6GkinRwAAAIA
            [REDIRECT_URL] => /wiki/Cookbook-V1/DropDownMenu
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 33922
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook-V1/DropDownMenu
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook-V1/DropDownMenu
            [SCRIPT_URL] => /wiki/Cookbook-V1/DropDownMenu
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afIks5MKBREdSxn6GkinRwAAAIA
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777476787.6651
            [REQUEST_TIME] => 1777476787
            [argv] => Array
                (
                    [0] => n=Cookbook%2dV1%2fDropDownMenu
                )

            [argc] => 1
        )

)