drewrockshard
drewrockshard

Reputation: 2071

MediaWiki Template Templates?

Not sure I have the correct terminology here. I'll explain what I want to do and you guys can tell me if it's possible.

I'm using MediaWiki as a Customer List page. So, I have a category for customers, and for instance, I have 20 customers. Inside the actual customer page I have several "headings" that make up the customer page, including an infobox. What I'm wanting to know is, how I would go about "including" the headings as a template "Customer Landing Page". Meaning, each "Customer Landing Page" (Customer A or Customer B, etc, etc) has the same "headings", but not the same content - so all I want is that each customer page, I can include a "template" and it has the same headings with no content under the headings - so that each time I change this "template" file, it changes it on every customer, and all I have to do is edit the content on the customer page that is required.

Upvotes: 3

Views: 649

Answers (3)

mor22
mor22

Reputation: 1372

You could look at using MultiBoilerPlate, I use this to set default text in pages. I would call this a template but Mediawiki uses that term for something else. If you just want to load the same default text when you start a new page and then fill it in with your own text, then I think this is what you need.

Upvotes: 0

Another option (but more complex) is the use of Navboxes. This requires a lot more set up but mayb be closer to what you are looking for?

Upvotes: 0

Stephan Muller
Stephan Muller

Reputation: 27600

You'll have to make one big template for the entire customer page, in which you put all the info. I'll make an example template for a page with two headers, "Customer Landing Page" and "More info". The headers are fixed, and the contents below it vary between customer page.

First, you make the template by creating the page Template:Customer

In here you put:

=Customer Landing Page=
{{{landingpagetext}}}

=More info=
{{{moreinfotext}}}

The triple accolades indicate the variables you will later define in each customer page. For customer A:

{{customer
| landingpagetext = This is the landingpage for customer A
| moreinfotext = This customer is a vegetarian
}}

Customer B:

{{customer
| landingpagetext = This is the landingpage for customer B
| moreinfotext = This customer likes Tom & Jerry
}}

The double accolades indicate the start of a template, and the first word is the templatename used. Then after each pipe ( | ) you can assign variables. I only used newlines to make it easier to read, you don't have to do that (but it makes it easier to maintain).

If you don't use the variable names (like {{customer|Landing page text|More info text}} ) you can access the variables by the order they are defined in, using {{{1}}} and {{{2}}} in the template.

If the customer pages are really big you might want to split the template up and use one per section.

Upvotes: 3

Related Questions