Aleksandr wrote:Can you give some real examples how to use your MyTemplate Plugin for DokuWiki?
ok, I'll try to explain as much as possible in a minimum example:
first, create a new page for the template. Use this for the content:
| Var1 | ~~VAR(0):var1~~ |
| Var2 | ~~VAR(0):var2~~ |
| Result1 | ~~VAR(1):RES~~ |
| Result2 | ~~CALC(0,RES):~~VAR(0):var1~~+~~VAR(0):var2~~ ~~ |
^ Col1 ^ Col2 ^
~~LIST(0):LISTELEMENTS:[| @0 | @1 | ]:5~~
Then create a second page for the data:
LISTELEMENTS= ( 'row1_col1', 'row1_col2' ),
( 'row2_col1', 'row2_col2' )
replace "templatetest" in the INCLUDE by the name of the first page.
Check out the result on the second page. The plugin inserts the dokuwiki-code from the template page into the first. It then replaces the placeholders in rows 1,2, and 4 of the first table by the values from the data page, then does the calculation for the 4th row and stores the result in "RES".
It then adds the values from LISTELEMENTS as rows to the second table and fills the table up to the minimum of 5 rows (that's the last element of the LIST-placeholder.
In a second pass through the page, it replaces the placeholder in the 3. row of the first table by the calculation result from the first pass.
Please note that if you change the template page, the data page is not automatically updated because dokuwiki caches the final result. To get it to update, you either have to edit the data page or add "&purge=true" to the url (of the data page) to clear the cache
I hope this is enough to get you started. Feel free to ask if you have further question.