Creating/editing articles with structured data[edit | edit source]
Some articles contain a mix of structured data and free form text. For example, an article that holds a description of a marketing contact or a bug report would normally have a set of questions that must always be answered to create a complete article. In this case, a form or an article with some preloaded wiki text might be more appropriate.
MediaWiki has four strategies for handling these kinds of situations:
Creating pages with preloaded text: Typically the freeform text includes a template with blank parameter values. The user fills in the template parameters as a kind of form within the wiki-text. The advantage of this approach is that, with the help of a few extensions, it can be easily implemented by end-users with basic wiki text and template knowledge. The disadvantage is that the forms are in wiki text and can be typed over by a careless user. For more information on this approach, please see Manual:Creating pages with preloaded text.
Special pages: A special page is a "virtual" mediawiki article whose page content is generated by PHP or Javascript code (i.e. it's not saved as a wiki article in the database). They can be used to provide forms for structured input. For information on adding your own special page, see Manual:Special_pages#Custom_special_pages.
Articles with embedded forms: Another approach to form based data entry is to create an article whose sole purpose is to define a data entry form. This can be viewed as kind of hard coded special page. The main advantage of this approach over the special forms approach is that one can easily put together an infrastructure that will let users create the data entry forms as part of the normal MediaWiki editing process. Articles with embedded forms for more information.
Intercepting the edit action: A fourth approach is to take over all or part of the MediaWiki editing process. When MediaWiki loads a page, it checks the action query parameter and calls one or more hook functions based on its value. By attaching a function to one of these hooks you can reinvent the entire page editing process. For more information, please see Intercepting page actions.