[Templates-cvs] cvs commit: TT3/examples htmlt.pl
cvs@template-toolkit.org
cvs@template-toolkit.org
Wed, 04 Feb 2004 15:36:23 +0000
cvs 04/02/04 15:36:22
Modified: examples htmlt.pl
Log:
* added ELSE and UNLESS
Revision Changes Path
1.2 +13 -2 TT3/examples/htmlt.pl
Index: htmlt.pl
===================================================================
RCS file: /template-toolkit/TT3/examples/htmlt.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- htmlt.pl 2004/02/04 15:21:48 1.1
+++ htmlt.pl 2004/02/04 15:36:22 1.2
@@ -63,7 +63,6 @@
return $handler->end_block('loop')
? $handler : $self->error($handler->error());
}
-
elsif ($start eq 'IF') {
return $self->error("no NAME provided for TMPL_IF directive")
unless $args->{ name };
@@ -71,9 +70,19 @@
return $handler->start_block( if => $args->{ name } )
? $handler : $self->error($handler->error());
}
+ elsif ($start eq 'UNLESS') {
+ return $self->error("no NAME provided for TMPL_UNLESS directive")
+ unless $args->{ name };
+ return $handler->start_block( unless => $args->{ name } )
+ ? $handler : $self->error($handler->error());
+ }
+ elsif ($start eq 'ELSE') {
+ return $handler->next_block('else')
+ ? $handler : $self->error($handler->error());
+ }
elsif ($start eq '/IF') {
# tmp hack
- return $handler->end_block('if')
+ return $handler->end_block()
? $handler : $self->error($handler->error());
}
else {
@@ -114,6 +123,8 @@
<TMPL_LOOP NAME="interest">
I like <TMPL_VAR NAME="interest"/>
</TMPL_LOOP>
+ <TMPL_ELSE>
+ I am very boring.
</TMPL_IF>
</body>
</html>