Difference between revisions of "Template:SetProp/RequiredBy auto"
From Salem Wiki
m (adding code) |
m (Changed protection level for "Template:SetProp/RequiredBy auto": images get protected also, so no cascade :/ ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude>{{#if: {{{page|}}} | <onlyinclude>{{#if: {{{page|}}} | ||
| {{#if: {{#ask: | | {{#if: {{#ask: | ||
− | [[:+]] [[RequiresObj::~{{{page|}}}*]] | + | [[:+]] [[RequiresObj::~{{{page|}}};*]] |
− | OR [[:+]] [[RepairedWith::~{{{page|}}}*]] | + | OR [[:+]] [[RepairedWith::~{{{page|}}};*]] |
OR [[:+]] [[RequiresTech::{{{page|+}}}]] | OR [[:+]] [[RequiresTech::{{{page|+}}}]] | ||
|sep={{{sep|,}}} | |sep={{{sep|,}}} | ||
Line 8: | Line 8: | ||
}}x | }}x | ||
| {{#arraymap: {{#ask: | | {{#arraymap: {{#ask: | ||
− | [[:+]] [[RequiresObj::~{{{page|}}}*]] | + | [[:+]] [[RequiresObj::~{{{page|}}};*]] |
− | OR [[:+]] [[RepairedWith::~{{{page|}}}*]] | + | OR [[:+]] [[RepairedWith::~{{{page|}}};*]] |
OR [[:+]] [[RequiresTech::{{{page|+}}}]] | OR [[:+]] [[RequiresTech::{{{page|+}}}]] | ||
|sep={{{sep|,}}} | |sep={{{sep|,}}} |
Latest revision as of 17:39, 25 July 2012
- SetProp/RequiredBy auto:
- You need to provide a value for the page parameter !
Template documentation (for the template shown above, sometimes hidden or invisible)
Description
- This helper-template is used, by {{SetProp}}, to automatically create a reverse-relationship, between the Properties RequiresObj, RepairedWith or RequiresTech of pages, with the current page.
- It does this by checking for the provided page-name as value in either of these properties on any page in the main-name-space using a SMW-Query like:
{{#ask: [[:+]] [[RequiresObj::~{{{page}}};*]] OR [[:+]] [[RepairedWith::~{{{page}}};*]] OR [[:+]] [[RequiresTech::{{{page}}}]] }}
- If it finds any results, then it sets Property:RequiredBy for the current page using these results as value.
- It uses
{{#arraymap:}}
as a wrapper to inject these values in{{#set:RequiredBy=<value>}}
.
Syntax
- Type the below code somewhere in {{SetProp}} or any-other code:
{{SetProp/RequiredBy auto |page={{{SUBPAGENAME}}} |sep={{{sep|,}}} }}
Visit Template:SetProp/RequiredBy auto/doc to edit this text! (How does this work?)