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