User:M.mendel/fetch

From Guild Wars Wiki
Jump to navigationJump to search

{{{src}}}/{{{1}}}

Usage[edit]

This template implements a "search path" for templates or pages; this ensures that a group of templates or pages keeps working even if only parts of it are moved to a new destination. Example:

{{fetch|MyExperimentalTemplate|src=''User:M.mendel}}

returns the first pagename of the following that actually exists:

  1. Template:MyExperimentalTemplate
  2. MyExperimentalTemplate
  3. {{NAMESPACE}}:{{BASEPAGENAME}}/MyExperimentalTemplate
  4. User:M.mendel/MyExperimentalTemplate
  • The first and second option are useful if the page/template gets moved to mainspace. The third option is used when the pages are being copied to another user's userspace, the {{NAMESPACE}}:{{BASEPAGENAME}} is going to be "User:ThisUser".
  • The last option should always be the original location, that is, {{{src}}}/{{{1}}} should always be the original page.

Notes[edit]

  • To use fetch for template calls, it has to be wrapped in a second set of parentheses to actually execute the call:
{{ {{fetch|''MyExperimentalTemplate''|src=''User:M.mendel''}} }}
  • Fetch can be used on any page as long as its name does not correspond to a template, to make it look up links. Example:
See [[{{fetch|MyExperimentalPage|src=User:M.mendel}}|MyExperimentalPage]]

To do[edit]

  • Find a way to pass the src= parameter on to the called template/page.