in reply to Re: (tedv)Re: Template system and substitution
in thread Template system and substitution
UPDATE: Geez I was just trying to be goofy and now I have to justify this ;P
OK, if you are just expressing basic values with your template system, you don't need nesting. If you are just enclosing code in another language you don't need nesting. If, however, you wish your template engine could do some light-weight decisions without having to resort to heavy code you might like having blocks like this:
[? variable_that_might_exist ?] HTML that uses the array that [$ variable_that_might_exist $] flags the existence of... [@ maybe_array @] [/ variable_that_might_exist /]
Worse, you may wish to emulate a light-weight version of a hash in template code like:
[% hash_name -> [$ key_1 $] %]
Sure it's stupid and there might be better ways but I have done something like it before (when I invented my own template system 4 years ago, where-o-where was Text::Template then?) and found that it was MUCH easier and safer to give my HTML people a seriously lightweight but "codeable" template system verses a glorified s/\[\$([a-zA-Z0-9_.-]+)\$\]/$hash{$1}/g system.
Tho there is no shame in that system =)
--
$you = new YOU;
honk() if $you->love(perl)
|
---|