Help:Semantic Forms for selecting Categories

From semantic-mediawiki.org
Semantic extension(s): Semantic Forms
Further extension(s):  -/-
Keyword(s): category

Description:

This tip is outdated and no longer applies to recent versions of extension "Page Forms"Allows to create and use forms for adding and editing pages with and without semantic data.

Extension "Page Forms"Allows to create and use forms for adding and editing pages with and without semantic data extension can be used for selecting multiple categories using a form, to do this you need to create two pages and you will probably want to enable the edit with form feature.

Form:Categories[edit]

The Form:Categories is used to generate the edit with form page and it places code like this into the page it is used to edit:

{{Category
 |Category=Category Name 1, Category Name 2, Category Name 3
}}

And this is the code to generate the multiple select form:

{{{field |Category |input type=categories |top category=Top_Category |height=200 }}}

The Top_Category being the start of the category tree.

Template:Categories[edit]

The Template:Categories generates the category listing in the page:

[[Category:Category Name 1]]
[[Category:Category Name 2]]
[[Category:Category Name 3]]

From the code generated by the Form:Categories.

This is the code to transform the comma separated list of categories into the format needed to place the page into the categories:

{{#arraymap: {{{Category}}} |, |@@@@ |[[Category:@@@@]] | }}