2009/8/7 Kathleen Borja jane88borj@yahoo.com:
Here are the files I've created for SpecialThesaurus extension:
SpecialThesaurus.php SpecialThesaurus_body.php SpecialThesaurus.alias.php SpecialThesaurus.i18n.php
The SpecialThesaurus_body.php file I've sent to Roan Kattouw this day consists of the major form elements. The contents are too long to be displayed here that's why I just sent it to Roan Kattouw's email.
I never got it. Please verify you've got the right address.
Questions:
About the contents on the SpecialThesaurus_body.php, am I on the right track?
About connecting to db, I used $dbr = wfGetDb(DB_SLAVE) command. How can I
check if it was really connected to the db? How can I fetch arrays from db? Are there db functions specially made for mediawiki that I can use?
If connecting with the DB fails, an error page will be displayed with your user and your code won't run past the wfGetDb statement, so you don't have to worry about that. Methods of the $dbr object are documented at http://svn.wikimedia.org/doc/classDatabaseBase.html . A simple example would be:
$res = $dbr->select( 'tablename', array( 'field1', 'field2' ), array( 'field1' => 'foo', 'field3=field1' ), __METHOD__ ); foreach ( $res as $row ) { // Do something with $row->field1, $row->field2 }
Note that $res is NOT an array, just a special object that happens to be foreach()able. PHP's array_*() functions WILL NOT WORK on it. That shouldn't be a problem though, because in most cases foreach() is all you wanna use.
What kind of Hook shall I use if I wanted the elements in SpecialThesaurus
(form including input boxes, etc.) be included some part of an article page? Let's say I wanted to put the form and other elements on the right part of the page.. How will I do it?
I'm not sure; I'll have to look that up.
With the three other files, what kind of contents shall I add to them?
Read the extensions manual page, in particular this section: http://www.mediawiki.org/wiki/Manual:Extensions#Internal_organization_of_an_...
Roan Kattouw (Catrope)