Line 51: |
Line 51: |
| Add permissible values as listed items starting either with "*" or "**" to the "MediaWiki:Smw_allows_list_..." page, e.g. "* Bar" or "** Foobar" to page "MediaWiki:Smw_allows_list_Foo".</nowiki> | | Add permissible values as listed items starting either with "*" or "**" to the "MediaWiki:Smw_allows_list_..." page, e.g. "* Bar" or "** Foobar" to page "MediaWiki:Smw_allows_list_Foo".</nowiki> |
| | | |
− | However, might want to go one step further and auto-generate this list from our own properties. For instance, all of our domains are marked with the [[Property:Is domain]] and our facilities are marked with the [[Property:Is facility]]. If you view the pages for [[MediaWiki:Smw_allows_list_Domains]] and [[MediaWiki:Smw_allows_list_Facilities]], you will see that they have the correct unordered lists. But if you view the source, you will see something like the following (from [[MediaWiki:Smw_allows_list_Domains]]: | + | However, might want to go one step further and auto-generate this list from our own properties. For instance, all of our domains are marked with the [[Property:Is domain]] and our facilities are marked with the [[Property:Is facility]]. If you view the pages for [[MediaWiki:Smw_allows_list_Domains]] and [[MediaWiki:Smw_allows_list_Facilities]], you will see that they have the correct unordered lists. But if you view the source, you will see something like the following (from [[MediaWiki:Smw_allows_list_Domains]]): |
| <nowiki>{{#ask: [[Is domain::True]] | | <nowiki>{{#ask: [[Is domain::True]] |
| |format=template | | |format=template |
Line 58: |
Line 58: |
| }} </nowiki> | | }} </nowiki> |
| | | |
− | This autogenerates the correct ordered list for everything marked [[Property:Is domain]]. One might think that using the |format=ul would create the appropriate unordered list format (with the * in front), but it apparently does not. Therefore, this query removes the page link (link=none) and reduces the entry to simple text, and then it uses the template ([[Template:Starlist_for_allow_value_list]]) to render the text with a * in front of it (''See [https://www.mediawiki.org/wiki/Help:Templates help on templates) for an explanation of templates'''. This works well. | + | This autogenerates the correct ordered list for everything marked [[Property:Is domain]]. One might think that using the |format=ul would create the appropriate unordered list format (with the * in front), but it apparently does not. Therefore, this query removes the page link (link=none) and reduces the entry to simple text, and then it uses the template [[Template:Starlist_for_allow_value_list]] to render the text with a * in front of it (''See [https://www.mediawiki.org/wiki/Help:Templates help on templates] for an explanation of templates'''. This works well. |
| | | |
| If, for some reason, you do enter a value that is not on the allowed list of values, the page will render a small warning icon. | | If, for some reason, you do enter a value that is not on the allowed list of values, the page will render a small warning icon. |