About categories... please include the display of categories in article
for skins other than monobook.
It is important that all cool features are displayed in all skins, to
ensure diversity of choice for editors. Otherwise, everyone will switch
to monobook to have the opportunity to see use new features; and we
might just declare now other skins dead (a dead skin... what an odd
idea... too much sun I guess)
ant
Nikola Smolenski wrote:
I have made a patch which enables display of all
articles that belong to
multiple categories. Thus, for example, Category:Female/Orthodox/Saint would
return all female orthodox saints (that is, all articles which are
categorised with at least [[Category:Female]], [[Category:Orthodox]] and
[[Category:Saint]]).
I am not sure would this make for much greater database load, but that remains
to be seen in practice. Line if(strchr($t,"/")) { and corresponding else
block are actually not needed but I have left them because I figure that
display of a single category is slightly faster this way, and that at that
point it would be easier to turn off this feature if needed. It should also
be easy to limit to number of categories if that turns out to be neccesary.
Index: Parser.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Parser.php,v
retrieving revision 1.135
diff -u -3 -p -r1.135 Parser.php
--- Parser.php 15 May 2004 00:29:07 -0000 1.135
+++ Parser.php 30 May 2004 09:11:00 -0000
@@ -318,7 +318,21 @@ class Parser
# FIXME: add limits
$t = wfStrencode( $this->mTitle->getDBKey() );
- $sql = "SELECT DISTINCT cur_title,cur_namespace FROM
cur,categorylinks WHERE cl_to='$t' AND cl_from=cur_id ORDER BY cl_sortkey"
;
+ $t = preg_replace("'/+'","/",$t);
+ if(strchr($t,"/")) {
+ $ta = explode("/",$t);
+ $tt="cur"; $tw="";
+
+ $i=0;
+ foreach($ta as $v) {
+ $tt.=",categorylinks as cl$i";
+ $tw.="cl$i.cl_to='$v' AND
cl$i.cl_from=cl".++$i.".cl_from AND ";
+ }
+ $tw=preg_replace("' AND
cl[0-9]+[.]cl_from=cl[0-9]+[.]cl_from AND $'U","",$tw);
+ $sql="SELECT DISTINCT cur_title,cur_namespace FROM $tt
WHERE $tw AND cl0.cl_from=cur_id ORDER BY cl0.cl_sortkey";
+ } else {
+ $sql = "SELECT DISTINCT cur_title,cur_namespace FROM
cur,categorylinks WHERE cl_to='$t' AND cl_from=cur_id ORDER BY cl_sortkey"
;
+ }
$res = wfQuery ( $sql, DB_READ ) ;
while ( $x = wfFetchObject ( $res ) ) $data[] = $x ;