Difference between revisions of "Template:Set Template Parameter"

From FollowTheScore
Jump to: navigation, search
(Replacing page with 'x')
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
x
+
{{#dpl:execandexit=<!--
 +
-->²{#vardefine: page ¦ {%DPL_arg1:?%}  }²<!--
 +
-->²{#vardefine: tpl  ¦ {%DPL_arg2:t%}  }²<!--
 +
-->²{#vardefine: parm ¦ {%DPL_arg3:p%}  }²<!--
 +
-->²{#vardefine: val  ¦ {%DPL_arg4:v%}  }²<!--
 +
-->²{#vardefine: exec ¦ {%DPL_arg5:no%} }²
 +
}}
 +
{{#ifeq:{{#var:page}}|?|
 +
call this page to change the value of a template parameter in a given page. Change will only be made if the last parameter (DPL_arg5) is set to 'yes'. Otherwise you will see what would be done.
 +
 
 +
&DPL_arg1 = page = {{#var:page}}
 +
&DPL_arg2 = tpl  = {{#var:tpl}}
 +
&DPL_arg3 = parm = {{#var:parm}}
 +
&DPL_arg4 = val  = {{#var:val}}
 +
&DPL_arg5 = exec = {{#var:exec}}    set to    yes  to perform the update
 +
 
 +
Use at your own risk - in strange cases templates or parameters may not be detected and changed.
 +
 
 +
Example:
 +
 
 +
  ..../index.html?title={{FULLPAGENAME}}&DPL_arg1=MyPage&DPL_arg2=MyTemplate&DPL_arg3=Some Parameter&DPL_arg4=The new value
 +
 
 +
}}
 +
{{#dpl:
 +
| execandexit = {{#ifeq:{{#var:page}}|?|&nbsp;|}}
 +
| title      = {{#var:page}}
 +
| include    = *
 +
| updaterules =
 +
replace  ~([\{][\{]\s*{{#var:tpl}}\s*.*\¦\s*{{#var:parm}}\s*=\s*?)[^\¦\}]*(\s*[\¦\}])~Us;
 +
by        \1{{#var:val}}\2;
 +
summary  STV: set value of parameter '{{#var:parm}}' to '{{#var:val}}' in call of template '{{#var:tpl}}';
 +
{{#ifeq:{{#var:exec}}|yes|exec;}}
 +
}}

Latest revision as of 14:51, 5 February 2011

{{#vardefine: page | ? }}{{#vardefine: tpl | t }}{{#vardefine: parm | p }}{{#vardefine: val | v }}{{#vardefine: exec | no }}

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:page}}' for parameter 'title'.


Extension:DynamicPageList (DPL), version 3.2.1: Error: No selection criteria found! You must use at least one of the following parameters: category, namespace, titlematch, linksto, uses, createdby, modifiedby, lastmodifiedby, or their 'not' variants


Extension:DynamicPageList (DPL), version 3.2.1: Warning: No results.