By hellekin
Description
The NewPage Module requires that you use a template: category, otherwise it complains that your template doesn't exist.
However, the newer template system make them sit at category:_template.
Fortunately, you can mix the two to obtain what you want!
Let's say we have a wooza category. We made a nice template sitting at wooza:_template:
+ %%category%%: %%page_name%%
by %%author%% (%%comments%% comments)
Wooza! Wooza %%content{1}%%
++ Wikidot rules!
%%content{2}%%
------------
[[module Comments]]
====
This is default content 1
====
This is default content 2
Code
Create a template:wooza page so that the NewPage module doesn't complain.
[[include wooza:_template]]
In action
Now, you can use:
[[module NewPage category="wooza" template="template:wooza" button="w00t!"]]
See it live on http://hackerspace.net/
Notes
In order to provide default values for templates:
- the template: system uses variables
- the category:_template system uses %%content{n}%% instead: this is what you should use.
Thanks to tsangk for this great snippet: conditional-blocks
text above inserted with:
[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]
Other snippets posted by hellekin
Rate this solution
If you think this solution is useful — rate it up!
With an existing "live" template ( categoryxyz:"_template") there is the "default" given with the content after the first "=====" line.
means - in such a case you need not a "standard" template ( "old" format "template:"categoryxy) for a "newpage" module..
Documentation: http://www.wikidot.com/doc:templates
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
It might be the lack of sleep but I didn't get anything from your entry. Did you update the docs? I read them before posting the tip, but couldn't find anything useful regarding the use of _template with the NewPage module (which was breaking).
… it would be enough with
wooza:_template
and
template:wooza
and elsewhere
gerdami - Visit Handbook en Français - Rate this howto:import-simple-excel-tables-into-wikidot up!
Ah! Thanks you for the heads up.
I'm a newbie with Wikidot and couldn't find any documentation on that.
So, you advise to put the template inside category:_template and the defaults inside template:category
Interesting. But I'm not sure how it's better than putting all into one place. Can you explain a bit more why it would be wiser?
Cheers!
The wazoo:_template can be changed at wish. When saving a new version of the _template, Wikidot recompiles all existing pages of the wazoo category. With many many pages, it can take a while.
The template:wazoo is not mandatory at all, it just helps, at new page creation, to remind that the page actually needs a content{1} and a content{2} (to follow the example you gave).
gerdami - Visit Handbook en Français - Rate this howto:import-simple-excel-tables-into-wikidot up!
Hey that makes a lot of sense. Thanks again for the explanation.