Jens Frank wrote:
There are several category names with a / in some languages:
Although some of them really really need to be renamed ("9/11" should be "September 11, 2001 attacks"; "Deutsche/r" should be "Deutsche(r)"), some are valid (e.g. "Sportturnier / -wettbewerb").
It seems that the pipe ("|") character is disallowed in our article titles (and hence, in categories too), but allowed in URLs (I couldn't find the relevant RfC on this for definite confirmation; can someone find it?). How about we use that instead?
Of course, the problem with that is that we can't link to combined categories. Any alternative suggestions are welcome.
Index: includes/Parser.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/Parser.php,v retrieving revision 1.135 diff -u -r1.135 Parser.php --- includes/Parser.php 15 May 2004 00:29:07 -0000 1.135 +++ includes/Parser.php 3 Jul 2004 10:49:33 -0000 @@ -318,7 +318,25 @@
# 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 c"; + $tw = ""; + + $i = 0; + foreach($ta as $v) { + $tt .= ", categorylinks cl$i"; + if ($tw != "") { $tw .= " AND "; } + $tw .= "cl$i.cl_to='$v' AND cl$i.cl_from=c.cur_id"; + $i++; + } + $sql = "SELECT DISTINCT c.cur_title, c.cur_namespace FROM $tt " . + " WHERE $tw ORDER BY cl0.cl_sortkey"; + } else { + $sql = "SELECT DISTINCT c.cur_title, c.cur_namespace FROM cur c, categorylinks cl " . + " WHERE cl.cl_to='$t' AND cl.cl_from=c.cur_id ORDER BY cl.cl_sortkey" ; + } $res = wfQuery ( $sql, DB_READ ) ; while ( $x = wfFetchObject ( $res ) ) $data[] = $x ;