[Mediawiki-l] Programmatically appending, not prepending, a category?

Jim Wilson wilson.jim.r at gmail.com
Tue Jan 29 18:21:28 UTC 2008


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 at 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 at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>



More information about the MediaWiki-l mailing list