I use the dbr/dbw convention and have tell it to switch databases to the external db in the extension.
$dbr =& wfGetDB( DB_SLAVE ); $dbr->selectDB($yourexternaldatabase);
This lets me use MW's built-in db access methods. It took me a while to learn how to do this, but it was worth it. It may be overkill if all you want is SELECT, and when I wrote my first extension, I just used the php mysql functions directly.
Jim
On Mar 20, 2008, at 4:07 PM, Bin Hu wrote:
Thanks.
Do you know any good documentation of mediawiki? I found the documentation in meidawiki project website a little difficult to follow. I want to customize mediawiki as part of an existing database- driven site written in PHP.
Regards, Bin
On Mar 20, 2008, at 9:36 AM, Jim Hu wrote:
Be careful with permissions using this approach, of course!!
On Mar 18, 2008, at 4:06 PM, Daniel Barrett wrote:
One approach: Write a custom tag (say, <mydatabase>) that hits your database using the API at http://us.php.net/mysql and returns results. For example, <mydatabase>select foo, bar from blat</mydatabase> could produce an HTML table of the results, with the column names (foo, bar) as the table headings.
DanB
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054