This question about Topic Markup Language and applications: Answered
Good way of creating auto updating template - is preparing two topics - model and actual template proper
Is my way of creating templates good or should I try something else?
Issue
I would like to create a template which I will be able to update easily by modifying one topic only.
For example, to change color which is used to display description, I would like to modify it in one place, not in every topic which I created using my template.
First of all, I create
ModelTopic which consist of:
<!--
* Set NOWYSIWYG = 1
-->
<noautolink>
---+!! %variable1%
---++ Short description
%IMAGE{"%variable2%" type="frame" align="right" caption="%variable3%"}%
%IF{"defined variable4" then="$percntINCLUDE{%variable4%}$percnt"}%
%IF{"defined variable5" then="%variable5%"}%
</noautolink>
In second step, I create another, topic (with "template" suffix) where I set variables and then include
ModelTopic .
<!--
* Set variable1 = Some text
* Set variable2 = %ATTACHURL%/test.jpg
* Set variable3 = Another text
* Set variable4 = Some topic
* Set variable5 = |*key*|*value*|
|wow|wow|
-->
%INCLUDE{ModelTopic}%
Having this, editing topic is equal to modifying variables values.
However is it a correct/good way of creating templates in Foswiki?
My concern is that in such case I'm not allowed to use WYSIWYG editor, since it may crash setting variables.
--
MateuszKDzior - 29 Sep 2015
One of the more powerful capabilities of Foswiki is
SkinTemplates combined with
DataForms. Move data that you want treated in a template into a data form, and then format the topic with the view template. We use this several places on foswiki.org.
- Foswiki security alerts
- Foswiki release notifications
--
GeorgeClark - 30 Sep 2015
GeorgeClark, thank you for answer, but is it possible to insert a table or call macro within
DataForms? The allowed data types seems to be static text - textarea or text.
--
MateuszKDzior - 30 Sep 2015