This page is a stub. You can help us improve Wikidot by expanding it. |
Templates are pre-made pages that act either
A) as a starting point for the creation of new wiki pages or
B) as a complete layout control for all pages of the same category.
Templates are like forms that you can load into a new page. The purpose of a template is to keep a similar content layout where needed. One example of a template is a blank recipe template that you can use to create a new page with and then simply fill in the details. The other usage is to control for a given category the layout of every pages for the whole "live" of the template.
Note : Wikidot templates are not like MediaWiki templates. If you are looking for something like MediaWiki templates, see the include page.
Note2 : "live" templates are working like CSS themes , but takes only control over the content-splitting for all pages of a category.
Example of a Template (std)
[!-- replace "Recipe Template" at the top with the name of your recipe --]
describe your recipe here. the following text is a place holder. Hannibal's Zombie Gumbo
has been a hit in New Orleans for many years. It is not only a rare treat for travelers,
it is shockingly crunchy.
+ Ingredients
* Add your ingredients here
* One poor soul, preferably dead.
* One can of tomatoes.
+ Directions
# Write your directions here.
# Preheat cauldron to scalding, while doing voodoo dance.
+ Comments
Tell us what you think about this recipe.
[[module Comments title=""]]
Example of a "live"-Template
[!-- -------------------------------------------------------------
This template belongs by its PAGE - NAME ("live-template2:_template") to ALL PAGES of the category "live-template2"
and uses 4 containers "content{1}" - "content{4}" as place holders to fill
Please - do not forget
1. That only the content{1} - {4} can be changed by the using pages!
2. That you are changing with this _template EVERY PAGE LAYOUT within this category!
3. Be careful with the default text in the content 1-4 - if a using page has no content than this text is inserted..
and
4. There is NO LIMIT in the numbering (1-4 ?) known till today!
--------------------------------------------------------------- --]
[[div style="float:right; width: 200px; border: 1px solid #999; margin: 10px;"]]
%%content{1}%%
[[/div]]
%%content{2}%%
[[table style="border: 1px solid #999;"]]
[[row]]
[[column style="border: 1px solid #999;"]]
%%content{3}%%
[[/column]]
[[column style="border: 1px solid #999;"]]
%%content{4}%%
[[/column]]
[[/row]]
[[/table]]
===========================
[!-- This is the default content for the template. When a new page in the category "live-template2" is created, it will automatically be filled with the following text --]
This will be content of the side bar.
===========================
The main content.
===========================
This will go into the left cell of the table.
===========================
And this into the right cell.
===========================
Every page of the category "live-template2" will use this template PERMANENTLY!
And therefore the only content that you need to put into a page in that category is the content for the four content blocks.
The filling is done by placing a splitting tag: "====" AFTER the container text. The tag is 4 or more "=" without any blank spaces (or other characters) after it!
"content{1}" will contain everything in the using page until the first splitting tag. {2} will take the text from there until the next splitting tag and so on.
PS: If you have only one content container (%%content%%) - without any numbering - than you don't need a splitting tag!
PPS: There is NO LIMIT in the numbering (1-4 ?) known till today!
Here is an example test-page - using the same category and the 4 splitting tags:
[!-- -------------------------------------------------------------
This page belongs by its PAGE - NAME ("live-template2:testpage4") to the template "live-template2:_template"
and is using 4 containers "content{1}" -" content{4}" as place holders to fill
Please - do not forget
1. that only the content{1} - {4} are possible for the using pages!
2. the splitting tag ( 4 or more "====" without any blank after ! ) is to be positioned AFTER the container text
3. if you need some "====" in the text ( without splitting it) than put one or more invisible spaces after it..
4. every text after the 4. Splitting tag is lost....
and
5. There is NO LIMIT in the numbering (1-4 ?) known till today!
--------------------------------------------------------------- --]
This will be content of the side bar.
===========================
The main content.
===========================
This will go into the left cell of the table.
===========================
And this into the right cell.
===========================
And this text is elsewhere... never shown or rendered!
In Action:
Another example of the usage of a live template is te little test - database-country
Creating Templates
Templates are normal pages, but are always associated with the using category.
"Starting" Templates
Should be created under category "template" and linked to the used category in the site manager ( "Page templates")
"Live" Templates
Are created automatically ( NO SITE MANAGER USED!) with the usage of a special name "starting with an underscore": _template inside a category.
The _template works with whichever category it was placed in as long as the template page "lives".
Bugs/Issues
The [[include]] tag cannot work with the "live _template" formatting!
Included is only the text from the page without using the template-controls!
- Tip: if you need a collection of "live _templated" pages than you can instead of [[include]] use [[iframe]] tag with the original (templated) pages / URL's.
Other way round - include tags in the split sections should work - please test carefully!
Editing Templates
In the case of a starting template (with a "starting" content) linked in the site manager, the effect only works for NEW created pages. If the template has changed you have no way of knowing this when you edit that page.
For "live" templates, if the content of the pages is changed when the page is rendered, the newest template layout is used!
Categories and Templates
Are linked either
- in the site manager for the "old" starting templates in the menu point page_templates or
- by using a special page called _template in a given category (if you want you can use the "_default" category - this is possible but gives all your default pages the same layout - if who wants this ?).
Default Template
In a "live" template you can change the "default text" in the containers for new created pages. This works from the moment of changes - not for existing pages - like the used standard templates.
Pages with text in the data containers ( defined by the splitting tag) are not changed.
Related Pages
http://www.wikidot.com/doc:templates explains the live template
database-country
http://community.wikidot.com/glossary:template Glossary entry of the 2 template formats
http://community.wikidot.com/fixwish:content-templates wish of content-templates
[
Backlinks
These pages link back to this one. You may find them helpful.