[Mediawiki-l] Re: how to create tree-like index from categories

Ashar Voultoiz hashar at altern.org
Wed Aug 24 22:06:03 UTC 2005


Jason Grant wrote:
> MediaWiki: 1.4.7
<snip>
> Here's an example of what I want:
> 
> MyTopLevelCategory
>   TopLevelChildCategory
>      PageThatIsInChildCatetory (hyperlinked)
> AnotherTopLevelCategory
>   AnotherChildCategory
>      AnotherPageThatIsInChildCatetory (hyperlinked)
<snip>
> I don't care about possible cycles in the graph - I'll just duplicate
> the leaves.

Try adding in your LocalSettings.php :
  $wgUseCategoryBrowser = true;

It's build in mediawiki since at least 1.4 and output something like:

----------------------------------------------------------------------
Category: TopLevelChildCategory | AnotherChildCategory

AnotherTopLevelCategory > AnotherChildCategory > AnotherPageT...
MyTopLevelCategory > TopLevelChildCategory > PageThatIsInChildCatetory
----------------------------------------------------------------------

One problem is that it sort lines by categories of the page instead of
the top categories :-/

You can probably customize its output by editing the method
Skin::drawCategoryBrowser . Actually use "<br />\n" between
categories and ' &gt; ' as a separator.

cheers,


-- 
Ashar Voultoiz - WP++++
http://en.wikipedia.org/wiki/User:Hashar
http://www.livejournal.com/community/wikitech/
IM: hashar at jabber.org  ICQ: 15325080




More information about the MediaWiki-l mailing list