I see there is support for ASP-like templating, like
<%IF blah%> <%= VARIABLE%> <%/IF%>
However I think, that it is too complicated that way.
I would better like it, if it would be made simpler.
Why do not use the following simplified template coding
style?
1. Condition examples:
1.1. If variable is equal condition
<%if blah eq 'hello'%><%variable%><%endif%>
1.2. If variable exists condition
<%if blah%><%variable%><%endif%>
1.3. If-elsif-else conditions
<%if blah %>
It has <%blah%> content.
<%elseif boo%>
It has <%boo%> content.
<%else%>
No content.
<%endif%>
1.4. Reverse conditions
<%ifnot page%>
Page missing.
<%endif%>
or
<%unless page%>
Page missing.
<%endif%>
1.5. Nested condition example:
<%if books%>
Author: <%author%>
<%if available%>
Available number of books in store:
<%amount_available%>
<%endif%>
<%endif%>
2. Loops
<%loop books%>
<%if author eq 'Shakespeare'%>
Quote from Shakespeare: <%quote%>
<%else%>
Author <%author%> is not Shakespeare.
<%endif%>
<%endloop%>
3. File include
<%if content%>
<%include content.html%>
<%else%>
<%include missing.html%>
<%endif%>
Thanks,
Webmaster33
Logged In: YES
user_id=460780
thanks for your comments. most of your suggestions are
already possible for a while. check the docs on CPAN, the
docs on sf are not up-to-date.
1.1 comparisons
At the moment you can only use the switch/case statement:
<%switch var%><%case foo%>foo...<%/switch var%>
and probably some time you will be able to use
<%if expr="var eq 'foo'"%>
1.2 exists
<%if var%>var is true<%/if%>
<%if_defined var%>var is defined<%/if%>
1.3 if-elsif-else
<%if foo%>foo
<%elsif bar%>bar
<%else%>whatever
<%/if%>
1.4 unless
<%unless foo%>no foo<%/unless%>
1.5 nested conditions
You can nest all tags as you like. maybe i didn't
understand you correctly. or dou you want <%with foo%>?
2. loops
are possible, and have been for a long time
3. include
are possible, and have been for a long time
Logged In: YES
user_id=132281
I checked the docs:
http://search.cpan.org/dist/HTML-Template-Compiled/lib/HTML/Template/Compiled.pm#TMPL_LOOP
The reason why I suggested the syntax change is, that the
current syntax is horrible, and I would never want to use it
in this style.
The following template language style IMHO is horrible and
unnecessary: TMPL_VAR, TMPL_LOOP, TMPL_(IF|UNLESS|ELSE),
TMPL_INCLUDE
The TMLP_ pre-tag is completely unneeded, when using ASP style.
VAR should be only optional for variable names not being
reserved command names.
<%VAR $IF = "text"%>
SET command could be used as alias of value setting cases, like:
<%SET $IF = "text"%>
The VAR command can be omitted in this case:
<%$variable = "text"%>
which is equal to:
<%variable = "text"%>
Also the <%/if%> closing tags are disturbing when using ASP
style. <%endif%> makes more sense than <%/if%>.
I hope with these examples, the suggestion is more clear now.
Thanks,
Webmaster33
Logged In: YES
user_id=132281
thanks for your comments. most of your suggestions are already
possible for a while. check the docs on CPAN, the docs on sf are
not up-to-date.
1.1 comparisons
At the moment you can only use the switch/case statement:
<%switch var%><%case foo%>var equals 'foo'...<%/switch var%>
and probably some time you will be able to use
<%if expr="var eq 'foo'"%>
1.2 exists
<%if var%>var is true<%/if%>
<%if_defined var%>var is defined<%/if%>
1.3 if-elsif-else
<%if foo%>foo
<%elsif bar%>bar
<%else%>whatever
<%/if%>
1.4 unless
<%unless foo%>no foo<%/unless%>
1.5 nested conditions
You can nest all tags as you like. maybe i didn't understand you
correctly. or dou you want <%with foo%>?
2. loops
are possible, and have been for a long time
3. include
are possible, and have been for a long time