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.
Create page Template:Foo
In page Bar, place {{Foo}}
Whenever Template:Foo changes, so do all instances of Foo
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:
In the page: http://en.wikipedia.org/wiki/London_Heathrow_Airport
In a template: http://en.wikipedia.org/wiki/O%27Hare_Airport
- The templates used:
- etc.
- Another example, this time adding a category to a page:
- with this template:
- adds this category:
This allows variable replacement.
- It's not clear what variables are you talking about.
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?
- No, with include you cannot replace distinct variables.
- Sorry, either I don't understood the request, or I don't see it in the examples.
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:
Create page Foo - any page can be used - no need for special page name, namespace
In page Bar, place [[Include(Foo)]]
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:
- ActionMarketTemplate
- BountyTemplate
- BugTemplate
- CategoryTemplate
- DayTemplate
- DeveloperApplicationTemplate
- EasyToDoTemplate
- EmptyPageTemplate
- FeatureRequestTemplate
- FeatureRequests/InterWikiTemplate
- HelpTemplate
- HomepageGroupsTemplate
- HomepagePrivatePageTemplate
- HomepageReadPageTemplate
- HomepageReadWritePageTemplate
- HomepageTemplate
- HowToTemplate
- MacroMarket/AirspeedTemplate
- MacroMarketTemplate
- MoinMoinBugs/MonthCalendarWrongArgumentsForUsingTemplate
- MoinMoinPatch/ExpandVariablesForNewPageFromTemplate
- ParserMarket/JTemplate
- ParserMarketTemplate
- PatchTemplate
- PatternTemplate
- ProjectGroupsTemplate
- ProjectTemplate
- ReleasePlanTemplate
- SlideShowHandOutTemplate
- SlideShowTemplate
- SlideTemplate
- SyncJobTemplate
- TourBusStopTemplate
- TranslationTemplate
- UsabilityObservationTemplate
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.
Creating a template is just creating a page that ends with "Template". You can use a [[NewPage()]] macro to create a button that creates new template page.
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…