Il giorno 13/set/08, alle ore 09:35, River Tarnell ha scritto:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kalan:
"Easy-to-read" is commonly hard or
sometimes even impossible to do
with pure SQL, so it should have a place for code to transform the
data to display it more efficiently.
this would probably be needed even for simple queries, e.g. to
translate
page_namespace+page_title into an actual title.
I have written some code for that, in my intersectContribs.php. Here
is it (generalized):
function getNamespacesForHost($host)
{
$serData = file_get_contents("http://$host/w/api.php?
action=query&meta=siteinfo&siprop=namespaces&format=php", 'r');
$nsData = unserialize($serData);
return $nsData;
}
$nsArray = getNamespacesForHost($wikihost); // The host is defined
somewhere
$curPageName = $MY_page_title; // Insert here the page title
$curPageNamespace = $MY_page_namespace; // Insert here the namespace
number
$curPageNamespaceName = $nsArray['query']['namespaces']
[$curPageNamespace]['*'];
if($curPageNamespaceName) // If the NS is not 0...
$pageTitle = $curPageNamespaceName . ":" . $curPageName;
else
$pageTitle = $curPageName;
print "<li><a
href=\"http://$wikihost/wiki/$pageTitle\">$pageTitle</
a></li>";
For this I use the API, because namespaces in different wikis are
different.
- river.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (SunOS)
iEYEARECAAYFAkjLbT0ACgkQIXd7fCuc5vIukwCeLN54e6BkYlaq0gPu3AYbhh5R
mYgAoIldxpPS+XFmVJDykWChqDPTUtjX
=7T/w
-----END PGP SIGNATURE-----
_______________________________________________
Toolserver-l mailing list
Toolserver-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Pietrodn
powerpdn(a)gmail.com