TagPages
Questions answered by this recipe
Description
Simple opaque web form for adding categories to a page. Varying levels of security available, but use should be limited to privileged users only.
Installation
Download tagpages.phpΔ and place in pmwiki/cookbook/ folder of your website.
Add to config.php:
include_once("$FarmD/cookbook/tagpages.php");
Configuration Options
Page Permissions
$XESTagAuth = 'read';
Default is that edit permission is required to add tags to a page. It's easier than editing the page and adding several [[!Category]] markups to each page. However, if you have read-protected pages you want authorized readers to tag, you may use this line to allow people with read permissions the ability to tag pages. Alternatively you may change it to 'admin' for admin-only tagging abilities, etc.
Authentication Prompt
$XESAuthPrompt = true;
Default is to require a password to save tags. Add before include line, and change to false to tag pages without requiring authentication. Note, this may be risky, please use on secure sites or in combination with Auth permissions.
Category Tag Placement (Bottom/Top of page)
$XESTagPosition = "bottom";
The new Category div is placed on the bottom of the wiki page text by default. You may add this to your config.php before including the recipe to add the tags to the top of the wiki page text instead.
CSS in pub/css/local.css
div.category { border: 1px solid #666; padding: 0.5em; background-color: #EEE; }
Usage
In-wiki usage example: add example markup to Group/GroupFooter in wiki (change the "if auth" to match the privilege level so only people who can use the form will see it):
(:messages:) (:if auth edit:)(:input form action={*$PageUrl}:) (:input hidden action xestagpages:) Tags: (:input text "Tags" size="40":) (:input submit value="Go":) (:input end:) (:ifend:)
This creates an input field for adding tags. Once submitted, a div is created on the page that contains the tag/Category list, de-duped, and in alphabetical order. To remove a tag, one will have to be able to edit the wikipage.
Tags are comma-separated, and may include normal characters and hyphens. Hyphens will be padded with spaces in the tag list. Characters not suitable for pagenames will be stripped from the tags.
Release Notes
- 2026-06-24
- fixed a bug producing duplicates on hyphenated categores until tagged again.
- added ability to save the pretty Category div to top of page instead of bottom
- improved security - now checks auth before parsing tags
- 2026-06-23
- Tweaks for more modern PHP, removing errors. Fixed bugs in the code, updated documentation to cover additional config switch.
- 2014-01-29
- No functional changes: added version number, tweaked instructions in script. This recipe has been working alone and with XESBlog since its creation on multiple websites for users with edit privileges.
Future possibilities:
- captcha
- form protections & parsing to allow use by non-privileged users
- could have made category divider configurable, meant to before packing this up....
See Also
- Bundle4Blog
- XESBlog
- live use at http://crisses.org/Poems/All3AprilFool but you're not a privileged user, so you won't see the form. Here's a screenshot:

Contributors
Comments
See discussion at TagPages-Talk
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.