Warning: Declaration of action_plugin_stratatemplatery::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php on line 24
Warning: Declaration of action_plugin_editx::register(&$contr) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/editx/action.php on line 18
Warning: Declaration of action_plugin_templatery::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/templatery/action.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/auth.php on line 430
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/Action/Export.php on line 103
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/Action/Export.php on line 103
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/Action/Export.php on line 103
====== Strata Templatery ======
Combining templates and data is a good way to display a lot of data while still keeping it readable.
===== Example =====
==== The Template ====
First we need a template:
=== @@name@@ ===
//Knows: @@knows@@//
See the [[templatery|Templatery manual]] for more information on templates.
==== The Data ====
Second, we need some data:
Name: Alice the First
Knows_ref*: #Bob, #Donna
Name: Bob the Builder
Knows_ref*: #Alice
Name: Carol the Third
Knows_ref*: #Donna, #Alice
Declaring data is done as described by [[stratabasic#Entering Data]].
==== Entering data with a template ====
By giving a template in data entry, you can format an entry as well:
template {
wiki:stratatemplatery
}
Name: Donna the Doer
Knows_ref*: #Alice, #Carol
template {
wiki:stratatemplatery
}
Name: Donna the Doer
Knows_ref*: #Alice, #Carol
Note: By prefixing a class with ''!'', you can get a quick template on the data entry. Though this relies on being able to get the template from the [[template:|template:]] namespace, and you can't use a ''#name'' style template. For example:
Name: Donna the Doer
Knows_ref*: #Alice, #Carol
This example would use the [[template:example_person|template:example_person]] template.
==== The View ====
Now we can combine the data and the template:
template {
manuals:stratatemplatery
}
?p is a: example_person
?p entry title: ?name
?p Knows_ref: ?knows
group {
?p
?name
}
The %%%% works exactly like [[stratabasic#Asking Questions]], with the addition of the ''template'' group.
The result:
template {
wiki:stratatemplatery
}
?p is a: example_person
?p entry title: ?name
?p Knows_ref: ?knows
group {
?p
?name
}
===== Lists =====
Lists can be template as well. This offers the option of displaying a list with customized items for each result.
?p is a: example_person
?p entry title: ?name
?p Knows_ref: ?knows
group {
?p
?name
}
**@@name@@** -> @@knows@@
The example code will result in:
?p is a: example_person
?p entry title: ?name
?p Knows_ref: ?knows
group {
?p
?name
}
**@@name@@** -> @@knows@@
===== Template with types =====
You can use types and aggregations in fields in the template. For example @@rating@max_stars@@ will determine the maximum value of the 'rating' field in the query, and display this with the 'stars' type.
==== Typed Templates ====
You can use types in vanilla templates as well. This allows you to display nicer templates without extra effort.
An example: @@a@@
With explicit type: @@B_ref@@
When filled in with ''%%a_wiki=5 ^_^ + 7 8-)%%'' and ''%%b=playground:playground%%'' this gives the following:
{{template>wiki:stratatemplatery#typed
|A_wiki=5 ^_^ + 7 8-)
|b=playground:playground
}}