Difference between revisions of "Template:SetProp/RequiredBy auto/doc"

From Salem Wiki
Jump to: navigation, search
m (undo last 2 steps. Changed my mind, it makes things too complicated)
m (→‎Description: added 'Loot' as dependency)
Line 2: Line 2:
 
:This helper-template is used, by {{t|SetProp}}, to automatically create a reverse-relationship, between the Properties [[Property:RequiresObj|RequiresObj]], [[Property:RepairedWith|RepairedWith]] or [[Property:RequiresTech|RequiresTech]] of pages, with the current page.
 
:This helper-template is used, by {{t|SetProp}}, to automatically create a reverse-relationship, between the Properties [[Property:RequiresObj|RequiresObj]], [[Property:RepairedWith|RepairedWith]] or [[Property:RequiresTech|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:
 
: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:
::<code><nowiki>{{#ask: [[:+]] [[RequiresObj::~{{{page}}};*]] OR [[:+]] [[RepairedWith::~{{{page}}};*]] OR [[:+]] [[RequiresTech::{{{page}}}]] }}</nowiki></code>
+
::<code><nowiki>{{#ask: [[:+]] [[RequiresObj::~{{{page}}};*]] OR [[:+]] [[RepairedWith::~{{{page}}};*]] OR [[:+]] [[RequiresTech::{{{page}}}]] OR [[:+]] [[Loot::~{{{page|}}};*]] }}</nowiki></code>
 
:If it finds any results, then it sets [[Property:RequiredBy]] for the current page using these results as value.
 
:If it finds any results, then it sets [[Property:RequiredBy]] for the current page using these results as value.
 
:It uses <code><nowiki>{{#arraymap:}}</nowiki></code> as a wrapper to inject these values in <code><nowiki>{{#set:RequiredBy=<value>}}</nowiki></code>.
 
:It uses <code><nowiki>{{#arraymap:}}</nowiki></code> as a wrapper to inject these values in <code><nowiki>{{#set:RequiredBy=<value>}}</nowiki></code>.

Revision as of 19:45, 9 July 2012

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}}}]] OR [[:+]] [[Loot::~{{{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|,}}}
}}