[ Follow Ups ] [ Post Followup ] [ Discussions at the Paneris system node ]

Even more templates

Posted by Myles on Sat Oct 3 11:59:34 1998

Distribution: paneris@i-way.co.uk

I have updated the templates so that you can say:

[[ TEST $var ]]
What is printed when var is true
[[ FAIL TEST $var ]]
The else bit
[[ END TEST $var ]]

in a template and the relevant bit of text will be included
depending on $var (as set by the environments).

Also, I have extended the [[REPEAT func]] section so that
if you give a tag a name attribute of the form

name=somefieldname[otherfield;]

then on each interation of the loop the name of the tag will
be set to somefieldnameXXXX, where XXXX is the value of
$otherfield. If the tag is an input field then its value
is set to the value of $somefieldname each time.

The idea is that $otherfield is unique on each on step
of the loop so that you can uniquely name REPEATED rows
of input boxes and set their initial values.

Example:

[[ REPEAT chalet ]]
$chaletname :
id;]>

[[ END REPEAT chalet ]]

will expand to:

Che Midgely :


Skis R us :

when &chalet returns 2 chalets, the first with id=36 and
notes="Too small", the second with id=56 and notes="Great!".

So we've got variables, loops and branches in this template
language. Stick a fork in it...:-)

Comments?

Myles




Follow Ups: