Reputation: 31
I'm a new user for mediawiki. I have installed and configured the semantic mediawiki correctly. Now I want to display a external database table in a wiki page. I tried External Data extension, but I didn't know how to display them correctly. Are there some tutorials available? Could you help me? Thanks!
Upvotes: 3
Views: 1836
Reputation: 15604
http://www.mediawiki.org/wiki/Extension:External_Data#.23get_db_data_-_retrieve_data_from_a_database
shows the basic steps. I have personally not found a good tutorial yet.
To try the feature out you might want to start with a query to your own Mediawiki. Create an extenal data server entry "mediawiki" in you LocalSettings.php that simply reuses your Mediawikis database configuration:
# external data configuration
$edgDBServer['mediawiki'] = $wgDBserver;
$edgDBServerType['mediawiki'] = $wgDBtype;
$edgDBName['mediawiki'] = $wgDBname;
$edgDBUser['mediawiki'] = $wgDBuser;
$edgDBPass['mediawiki'] = $wgDBpassword;
Then add a macro to fetch some data from the user table (which is a standard Mediawiki table) in some page of your choice:
{{#get_db_data:
|server=mediawiki
|from=user
|where=not user_name ='Wikiroot'
|data=id=user_id,login=user_name,name=user_real_name
}}
To display the data you might want to use #for_external_table:
{| class="wikitable"
! id
! login
! name{{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{id}}}
{{!}} {{{login}}}
{{!}} {{{name}}}
}}
|}
You should get a table with id, login and name of your mediawiki users except wikiroot.
Upvotes: 2