Hey everyone, I've been happily running my mediawiki for a while now and I implemented a little 5 line fix so that I could do interwiki links for Google and a few other things effectively. The catch with Google and many other services is that they don't like to interpret underscores as spaces. My hack was to leave all $1 interwiki links alone but add a $2 symbol for use when you actually want real spaces (or %20) in your URL.
It is getting a little tedious editing my change into the main each update and I'd imagine this might be a decent feature or fix if implemented correctly.
I didn't know much about the innards and figured out only enough to make it work, so here goes: I changed the function getFullURLs() in ./includes/Title.php by switching this: $url = str_replace( '$1', $namespace . $this->mUrlform, $baseUrl ); if ( '' != $this->mFragment ) { $url .= '#' . $this->mFragment; } return $url; with this: $urlPre = str_replace( "$1", $namespace . $this->mUrlform, $baseUrl ); if ( '' != $this->mFragment ) { $url .= '#' . $this->mFragment; } $url = str_replace( "$2", $namespace . str_replace("_", "%20", $this->mUrlform), $urlPre); return $url;
I then changed all of the bits of the URLs in the database entries of the Interwiki table which should have spaces from $1 to $2.
What do you think?
Thad
This would probably break something involving links.
One way to do it would be to run the query: INSERT INTO `interwiki` ( `iw_prefix` , `iw_url`) VALUES ('Cache', 'http://www.google.com/search?q=cache:$1'); INSERT INTO `interwiki` ( `iw_prefix` , `iw_url`) VALUES ('Google', 'http://www.google.com/search?q=$1'); INSERT INTO `interwiki` ( `iw_prefix` , `iw_url`) VALUES ('GoogleGroups', 'http://groups.google.com/groups?q=$1');
Although this will generate the standard Titles_with_underscores_in_between_words.
On Sun, 27 Mar 2005 22:55:15 -0500 (EST), Thad Kerosky thadk@alltel.net wrote:
Hey everyone, I've been happily running my mediawiki for a while now and I implemented a little 5 line fix so that I could do interwiki links for Google and a few other things effectively. The catch with Google and many other services is that they don't like to interpret underscores as spaces. My hack was to leave all $1 interwiki links alone but add a $2 symbol for use when you actually want real spaces (or %20) in your URL.
It is getting a little tedious editing my change into the main each update and I'd imagine this might be a decent feature or fix if implemented correctly.
I didn't know much about the innards and figured out only enough to make it work, so here goes: I changed the function getFullURLs() in ./includes/Title.php by switching this: $url = str_replace( '$1', $namespace . $this->mUrlform, $baseUrl ); if ( '' != $this->mFragment ) { $url .= '#' . $this->mFragment; } return $url; with this: $urlPre = str_replace( "$1", $namespace . $this->mUrlform, $baseUrl ); if ( '' != $this->mFragment ) { $url .= '#' . $this->mFragment; } $url = str_replace( "$2", $namespace . str_replace("_", "%20", $this->mUrlform), $urlPre); return $url;
I then changed all of the bits of the URLs in the database entries of the Interwiki table which should have spaces from $1 to $2.
What do you think?
Thad _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org