Hi H::T users,
 
I often find myself generating template code such as:
 
<TMPL_UNLESS error>
    <TMPL_UNLESS print>
        <TMPL_IF some_var>
            .... do something...
        </TMPL_IF>
    </TMPL_UNLESS>
</TMPL_UNLESS>
 
The equivalent using H::T::E would be:
 
<TMPL_UNLESS EXPR="((defined error) or (defined print)) and ....">
    ... do something...
</TMPL_UNLESS>
 
both syntax's are reasonably ugly...
 
 
What about a syntax like:
 
<TMPL_IF !error,!print,some_var>
    ... do something...
</TMPL_IF>
 
?  ... thoughts...?
 
Note that this syntax is not designed to replace H::T::E.
We could also replace the '!' with 'not' if people prefer .. or even have both forms.
 
Internally this syntax would expand into the first example, so therre would be no functional change...
The idea is simply to make writing complex templates, a little easier to read.
Also, given that it is expanded into the first example, there would be minimal processing overhead as the expansion would only happen before the template became cached.
 
regards,
Mathew
 
BEGIN:VCARD
VERSION:2.1
N:Robertson;Mathew
FN:Mathew Robertson
ORG:RedSheriff
TEL;WORK;VOICE:+61 3 8606 4041
URL;WORK:http://www.redsheriff.com
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20040220T003703Z
END:VCARD

Reply via email to