How To Create Templates

How to use templates.

What are they?

These are pre - prepared pages, pro - formers, forms that you may wish your wikidot contributers to use.

An excellent example of a template can be found at
http://siliconcity.wikidot.com/template:herocharacter , a template which includes
http://siliconcity.wikidot.com/HeroBox of which all parameters such as {$origin}, {$archetype} or … will be replaced by actual values.

Step one.

Preparing one.
But before we do, go and have a look in Site Manager » Page templates
Note that it will inform you that you don't have any! So best we make one.

Using the new page button on the side menu bar, create a new page called (for example):-

template:typeone

the "template" is the category reserved for templates.
"typeone" is the name you wish to give it.

Then type some text in it how you would like. You can always edit it later, so for example lets put in:-

  • Ingredients
  • Cooking time
  • method
  • serves

Save it.

Just for the hell of it, let create another template called "typetwo"
Again, in the New Page box on the side bar create a page named
template:typetwo

Then enter some text, eg:-

  • Country of origin
  • Alloy type
  • Value

Now lets go back to Site Manager » Page templates

You will see two boxes.
The left one shows the Categories used in your site.
The right one lists the templates you have made.

If you click on the templates listed, you will see a preview underneath. (note i could only get it to preview one of them. I think there is a bug, but don't worry)

Now go back to your site
Create a new page in the New page box on the side bar.
Have a look in the edit box
you should see a new drop down box

Initial template: no template (default)

This should display the templates you have created. (note there is also a number of no template (default) listed. Again I think this is a bug.)

Click on the one you wish to use.

Job Done!!


Part two: assigning templates to Categories.

You might find it useful to use a particular template for a particular category.

Eg.

category Template
breads bread template
meats meat template
Cakes Cake template

First lets create the templates as we did above.

eg :-

  • template:bread template
  • template:meat template

Then we create the categories, using the New Page box. More info here. It will be a good idea to have a "base" "start"page, or "Introduction" page to each category.
eg:-

  • Breads:basebread
  • Meats:basemeat

Adding the create page box

Lets use "breads" as an example.

  • create template. Called. template:breads
  • create new page called breads:basebread

In the new breadbase page inset the following code

[[module NewPage category="bread"]]

Once you have saved that new page you should have a new "create page" box displayed

create page

creating new pages within it, eg:-

  • newpage one
  • newpage two
  • newpage three

will do two things.

  1. create a new page and automatically put it in the "breads" category
  2. present the user with the template required for that category.

Job done.
( i do hope i have this right :) )

EDIT
Sorry this does not work. As you describe here it appears that by creating a template "template:name" and a category "name:", the template somehow magically appears when the module NewPage is used inside page "name:". This is not so. One needs to explicitly mention the template and the category to use in the module "NewPage".
eg [[module NewPage category="balls" template="ball-template"]]

Links

Sites that use the "template / include" technique:

A complete other template usage is the "live" template :

Authors

Phil ChettPhil Chett. Please visit his/her userPage.

page tags: howto include template
page_revision: 15, last_edited: 1211102187|%e %b %Y, %H:%M %Z (%O ago)
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.