Change Layout using Tags
This is an experiment or a very simple site to illustrate how you can change the layout of a page using Tags.
If you have a look at mycategory:_template you will see that is a very easy to understand template. It uses the power of [[iftags]]. With iftags you can do things that depend on the tags of a page.
SO
- I made some pages in one category : "mycategory" to be exact : France Italy Belgium
- I made two layouts : mycategory-layout1 mycategory-layout2
NOW
if you make a new page in category "mycategory" and you give it the tag "_layout1" it will get Layout1 defined in mycategory-layout1
I don't see many use for this because a page can only be presented to a surfer/reader in one way (layout1 or layout2) the surfer/reader can not choose for him/herself, but I can imagen that for some people it is handy.
Code of mycategory:_template
if you copy this you need to remove the @@
[[iftags _layout1]]
@@[[include layouts:mycategory-layout1]]@@
[[/iftags]]
[[iftags _layout2]]
@@[[include layouts:mycategory-layout2]]@@
[[/iftags]]
[!-- catch when no layout tag is defined --]
[[iftags -_layout2 -_layout1]]
No layout tag is defined!
[[/iftags]]
====
[!-- Capital --]
====
[!-- language --]
====
[!-- short descripion --]
Code of layouts:mycategory-layout1
++ This is layout1
it shows all the content and a list of other pages
+ %%content{1}%%
+++ Capital: %%content{2}%%
+++ Very short description
%%content{3}%%
++ A list of other countries
[[module ListPages category="mycategory" order="name"]]
%%title_linked%% : %%content{2}%%
[[/module]]
Code of layouts:mycategory-layout2
++ This is layout2
This is a layout where the content is in a table
||~ Country||~ Capital||~ Language||~ Comment||
||**%%name%%**||%%content{1}%%||%%content{2}%%||%%content{3}%%||
++ A list of other countries
[[module ListPages category="mycategory" order="name"]]
%%title_linked%% : %%content{2}%%
[[/module]]
page revision: 5, last edited: 25 Nov 2009 14:00