开发者

Mediawiki and databases

开发者 https://www.devze.com 2023-02-15 17:18 出处:网络
Is there a way I can create a database from which to pull data into my mediawiki table? Or is there a way to have a database like drupal and place a开发者_Python百科 mediawiki type interface on it?The

Is there a way I can create a database from which to pull data into my mediawiki table? Or is there a way to have a database like drupal and place a开发者_Python百科 mediawiki type interface on it?


There is no way to directly do this in stock MediaWiki, although you can fake it up somewhat with templates. For example, you could can a template something like this:

{{#switch:{{{key}}}
 | key1 = value1
 | key2 = value2
 | key3 = value3
 ...
}}

Template:NUMBEROF/data on the English Wikipedia is an example of this style (with two levels of keys).

Or you can create a set of templates, one for each "record", that each take an "output formatter" template as a parameter and pass that output formatter a named parameter for each column in the record. The Country data templates on the English Wikipedia are an example of this pattern.

Or you could combine the above two styles, with one parameter to select the row (as in the first style) and a second to provide the output formatter (as in the second).

If you don't mind installing extensions, you could use the Labeled Section Transclusion extension to transclude sections of a data page. Or you could install the Semantic MediaWiki extension, which I hear allows all sorts of querying of data from the wiki's pages. Or you could install one of the many Database extensions that may allow you to do what you want. Or you could write your own database extension.


You could also have a look at http://www.mediawiki.org/wiki/Extension:Data_Transfer, which do not require Semantic MediaWiki even though it's written for use with SMW. (If you use SMW there are, as noted in an earlier reply, plenty extensions and built in options.)

0

精彩评论

暂无评论...
验证码 换一张
取 消