Short description

Templates are another part of FeatureRequests/NameSpaces. They allow the creation of a standard message that can be place or pasted into a page.

  1. Create page Template:Foo

  2. In page Bar, place {{Foo}}

  3. Whenever Template:Foo changes, so do all instances of Foo

  4. Alternative {{subst:Foo}} allows the user to copy the contents of Foo into Bar. Thus when Foo changes, this copy doesn't

Here is an example: The following 2 pages have an info to the side of the screen. One just has the code in the page, and the other places it in a template:

This allows variable replacement.

Discussion

Maybe I got it wrong, but you can do that today with the [[Include()]] macro (see HelpOnMacros/Include). With it, you can include other page contents, like your example of {{Foo}}. Isn't this so?

What you ask for is include, not templates. MediaWiki call this templates, but this is not how templates are use in any other software.

You do this like this:

  1. Create page Foo - any page can be used - no need for special page name, namespace

  2. In page Bar, place [[Include(Foo)]]

  3. Whenever Foo changes, so do all instances of Foo

  4. Alternative, visit Foo, copy its text and paste in your page. Thus when Foo changes, this copy doesn't.

Whats the problem?

Also, MoinMoin has page templates. When you create a new page you can use a template to get a standard text for this kind of page. MoinMoin templates are not included in pages but copied, just like it work in any other software.

See these pages for examples:

There are two features in the MediaWiki templates. The include feature which is also in MoinMoin as to import a piece of text from one page to the other. The second feature is that "variable replacement". For example in your template "Foo", you might have things like city: {cityname} country: {countryname} AND in the page Bar, you would have the possibility [[Include(Foo| cityname="New-York"|countryname="USA")]]. So it's an include of a Foo template with variable substitution, variable values which are coming from the Bar page.

Variable replacement sounds like a nice easy solution, but I tried it and nothing happens if I pass parameters in the Include call?


Thats great but it would help if there was a 'create your own template' button somewhere.

The card macro does most of what is required here, marking as Implemented. -- TheAnarcat 2006-05-14 23:32:52


Yes, Include helps, but there is one point missing. If I use the Include for navigation purpose, in a MediaWiki Template the link to the page itself is not anymore a link, but bold text. In a MoinMoin Include, the link to the page itself remain a link. Well, this is not a great problem, but the way from MediaWiki is nicer…


CategoryFeatureImplemented

MoinMoin: FeatureRequests/Templates (last edited 2012-12-08 15:35:56 by dyn)