In an extension, I'm using Brion's method to add a category to a page automatically:
$cat = Title::makeTitle(NS_CATEGORY, "My category"); $wgParser->mOutput->addCategory($cat->getDBkey(), $wgParser->mTitle->getPrefixedText() );
This always prepends the category so it appears first on the page. Is there a way to make it appear last instead?
I tried setting the second parameter ("sort") parameter to something like "zzzzz", but looking at the rendering in OutputPage-> addCategoryLinks(), this parameter appears to be unused.
Thanks for any help. DanB
I tried setting the second parameter ("sort") parameter to something like "zzzzz", but looking at the rendering in OutputPage-> addCategoryLinks(), this parameter appears to be unused.
sort is used to sort the articles within the category, not the categories within the article, I believe.
When are you adding this category? Can you not just concatenate the wikitext onto the end of the article when it's saved?
The category is added dynamically by a tag extension. Any page that uses the tag <foobarblat> is automatically placed into category "Foo". Doing it at article-save time would not work, since the tag could be present by transclusion (e.g., added later to a template used by the article).
We use this technique to keep track of all articles that use some resource-intensive tags. (For example, accessing external databases.)
DanB
-----Original Message----- Thomas Dalton asks: When are you adding this category? Can you not just concatenate the wikitext onto the end of the article when it's saved?
Daniel:
Instead of this: $wgParser->mOutput->addCategory($cat->getDBkey(), $wgParser->mTitle->getPrefixedText() );
Try this: $tmparr = array(); $tmparr[$cat->getDBkey()] = $wgParser->mTitle->getPrefixedText(); $wgParser->mOutput->mCategories = array_merge( $tmparr, $wgParser->mOutput->mCategories );
Note: I haven't tried/tested the above - just a guess :)
-- Jim
On Jan 29, 2008 12:09 PM, Daniel Barrett danb@vistaprint.com wrote:
The category is added dynamically by a tag extension. Any page that uses the tag <foobarblat> is automatically placed into category "Foo". Doing it at article-save time would not work, since the tag could be present by transclusion (e.g., added later to a template used by the article).
We use this technique to keep track of all articles that use some resource-intensive tags. (For example, accessing external databases.)
DanB
-----Original Message----- Thomas Dalton asks: When are you adding this category? Can you not just concatenate the wikitext onto the end of the article when it's saved?
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org