Hi,
I'm trying to play around with the category page a little bit. Everything would be a lot easier if I could just somehow get an array with all pages listed in category x. Can you guys give me some hints on how to create such a function? Unfortunately the databaselayout does not talk about categorylinks.
cheers,
dennis
On 4/9/05, Dennis Schaaf dennis.schaaf@gmail.com wrote:
Hi,
I'm trying to play around with the category page a little bit. Everything would be a lot easier if I could just somehow get an array with all pages listed in category x. Can you guys give me some hints on how to create such a function? Unfortunately the databaselayout does not talk about categorylinks.
Dennis,
cl_to is the name of the category. cl_from is the id of the page that belongs to that category -- matches cur_id cl_sortkey gives the page name that should be used when sorting the category list.
So, SELECT cl_from FROM categoryLinks WHERE cl_to="Albania" will return a table with the cur_id's for all pages in category Albania
-- Rich Holton
[[W:en:User:Rholton]]
On 4/10/05, Richard Holton richholton@gmail.com wrote:
On 4/9/05, Dennis Schaaf dennis.schaaf@gmail.com wrote:
Hi,
I'm trying to play around with the category page a little bit. Everything would be a lot easier if I could just somehow get an array with all pages listed in category x. Can you guys give me some hints on how to create such a function? Unfortunately the databaselayout does not talk about categorylinks.
Dennis,
cl_to is the name of the category. cl_from is the id of the page that belongs to that category -- matches cur_id cl_sortkey gives the page name that should be used when sorting the category list.
So, SELECT cl_from FROM categoryLinks WHERE cl_to="Albania" will return a table with the cur_id's for all pages in category Albania
-- Rich Holton
[[W:en:User:Rholton]]
Also, as GeraldM points out in a separate thread, if you're looking to do this for a large installation like Wikipedia, some categories may grow quite large--perhaps into 10's of thousands of pages (think of category:stub). So, depending on how and where you want to use this, PHP arrays may be impractical.
-Rich Holton
Also, as GeraldM points out in a separate thread, if you're looking to do this for a large installation like Wikipedia, some categories may grow quite large--perhaps into 10's of thousands of pages (think of category:stub). So, depending on how and where you want to use this, PHP arrays may be impractical.
OK, I really shoud wait til I'm fully awake...it was GerardM,not GeraldM. Gerard, please forgive me!
-- Rich Holton
[[W:en:User:Rholton]]
At 4/10/2005 12:50 AM, Dennis Schaaf wrote:
Hi,
I'm trying to play around with the category page a little bit. Everything would be a lot easier if I could just somehow get an array with all pages listed in category x. Can you guys give me some hints on how to create such a function? Unfortunately the databaselayout does not talk about categorylinks.
I actually wrote an extension that does just that (and more), i.e. it creates a TOC of pages matching criterions, and you can definitely specificy the category name to be one of them (or even match a pattern).
http://public.kitware.com/Wiki/User:Barre/MediaWiki/Extensions/kw_site_map
-- Sebastien Barre
wikitech-l@lists.wikimedia.org