Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki Kostenlos Bücher Online Lesen
Autoren: Yaron Koren
Vom Netzwerk:
page title that’s generated is unique. Normally, this value starts out as blank, then goes to 2, then 3, etc. However, one can manually set the starting number for this value, by adding a “start=” parameter; this number must be 0 or higher. For instance, to have the number start at 1 and go upward, you should set the tag to be

. You can also instead set it to be a random six-digit number, by adding the "random" parameter, so that the tag looks like "

". Note that the parameter in either case is delimited by a semicolon.
    Note that the "
page name=
" value cannot start with "

", due to a bug in Semantic Forms; there has to be some text before that. And it cannot contain the character "#", because MediaWiki does not allow pound signs in page titles.
    As an example, imagine a form for storing notable quotes. Its 
{{{info}}}
 tag could have a parameter of "
page name= quote
". This would include the author’s name in the name of every quote page, as well as a number to guarantee the uniqueness of every opinion-item page added. A user could then go to the URL "http://mywiki.com/wiki/Special:FormEdit/Quote" and fill out the form; if they set the author to be "Ernest Hemingway", and no other quotes in the wiki had him as an author, then hitting the "Save page" button would result in a new page called "Ernest Hemingway quote 1" .
    The "start" value can have leading zeroes; a value of "001", for instance, would lead to pages that had the value "001", then "002", etc.
    The "page name=" value gets parsed by the MediaWiki parser, so you can also add parser functions, pre-defined variables, etc. into the value.
    Note that users must be sent to the page "Special:FormEdit/ form-name " for this automatic page-setting to work; if they somehow end up at a #forminput call and are prompted for a page name, that name will override whatever the automatic page name would be.
Using #formlink
    If you want, you can generate a link to a “one-step process” form using the "#formlink" parser function, instead of creating the URL directly. This function is called as:
{{#formlink:form= |link text= |link type= |query string= | query string parameters |target= |tooltip= |popup}}
    The "form=", query string and "popup" arguments work much the same way that their equivalents in #forminput work, and "link text=" works like #forminput’s "button text=". The "link type=" argument sets the display of the link: if it’s set to "button", the link will show up as a button; if it’s set to "post button", it will be a button that sends the query-string value(s) using "POST" instead of via the URL — this is helpful when a lot of data has to be preloaded, and it is more robust with special characters like line breaks in the query string; if it’s set to blank or anything else, it will show up as a regular link. The "target=" parameter shouldn’t usually be used, but it sets the target page to be edited, if you want to link to the editing of a specific page. The "tooltip=" parameter displays a "tooltip", displayed if a user hovers the link.
    An example call to #formlink would be:
{{#formlink:form=Quote |link text=Add a quote for this author |link type=button |query string=Quote[Author]={{PAGENAME}} }}
    This will link from the page, via a button, to a form for adding a quote, with the "Author" field filled in with the current page name.
    You may want to have the link to the form be an image, instead of text or a button. For that, you could call something like:
{{#formlink:form=Quote
|link text= [[File:edit.png|link=]]}}
Pointing red links to a form
    In MediaWiki, links to nonexistent pages are called ’red links’, because they are usually colored red. By default, these links go to a page for adding the article to the wiki using the standard edit interface. However, if that nonexistent page is being pointed to by a semantic property, the red link can instead take the user to the correct SF form to add the page.
    The standard way to point red links defined by a property to a certain form is to simply add the special property "Has default form" to the page for that property. For instance, in a property page like “Property:Has employee”, you could have the following:
This property uses the form [[Has default form::Employee]].
    Setting the default form can be done directly within the’CreateProperty’ page.
    In addition, or

Weitere Kostenlose Bücher