Category Templates And Newpage

By hellekinhellekin

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!

rating: +6+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License