Summary: Assembles all Categories
in a page, alphabetizes, and appends to bottom of page--in the style similar to MediaWiki.
Status: Stable as of 2.1.5
I want a painless way of implementing the Mediawiki markup for categories.
Media Categories simulates the style of the Mediawiki wiki markup. When categories are listed on a line it will label them and put them into a block.
To use this script, simply copy it into the cookbook/ directory and add the following line to config.php (or a per-page/per-groupcustomization file).
Throughout the document, you can place the categories, for example [[!ChickenRecipes]] and [[!Frog Recipes]]. These are pulled from the page, alphabetized, then added at the end of the page. This recipe allows you to set the singular/plural of the category list that is then appended to the end of the page like thus:
Categories: ChickenRecipies | Frog Recipes
The categories are also encapsulated in a div statement (named "category") that allows the site administrator to customize the style for this block.
- Download the mediacat-2.0.phpΔ file, and put in your cookbook directory.
- Add this line to the appropriate config.php file
include_once("path/to/cookbook/mediacat-2.0.php");. It is better to put this line after
any redesignation of
$CategoryGroup. This variable is used establish the correct link.
- Use it.
New in Version 2.0
My friend Mateusz brought up some good points in a list of notes. In the spirit of friendly competition, I chose to respond by making a better product. Granted, it took me a few months to notice the comments. BenWilson May 07, 2006, at 04:44 PM
- MediaCategories now pulls free links? using the PmWiki syntax [[!Category Name]], even with spaces.
- Categories can appear anywhere in the page. After being inventoried, these categories
are appended to the end of the page.
- This version does not rely on spaces, which presented a serious problem in v1.0
- This sets the singular form of the category label. Defaults to "Category:"
- This sets the plural form of the category label. Defaults to "Categories:"
- This determines what the seperator format is. Defaults to ' | '
- This creates the markup that creats the block.
- This creates the markup that terminates the block.
- This is the CSS that is added to
$HTMLStylesFmt when categories are marked up by this script.
- August 7, 2005 (version 1.0) - Split a list of categories separated by spaces.
- May 7, 2006 (version 2.0) - Applied different approach to grabbing the categories that did not rely upon spaces.
See discussion at MediaCategories-Talk?
Ben Wilson Maintained
User notes? : 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.