Re: [Templates] Overriding the default iterator

[prev] [thread] [next] [Date index for 2004/09/03]

From: Buddy Burden
Subject: Re: [Templates] Overriding the default iterator
Date: 16:36 on 03 Sep 2004
Adam,

> Of course, there's always Template::Plugin::Cycle, designed for just 
> your sort of situation... especially if you just want row backgrounds 
> and such.

Well, I will definitely look into that, as that is one thing (probably 
the most common thing) I use it for.  But there are other things as 
well; for instance, just last night I did a six-column table that was, 
from the user perspective, two columns, each cell of which had 3 items 
in it.  So I did something like this:

     <table ...>
         [% FOREACH method IN all_methods %]
             [% '<tr>' IF loop.count % 2 == 1 %]
                 <td> <input type="radio" name="method" value="[% 
method.id %]"> </td>
                 <td> [% method.rate %] </td>
                 <td> [% method.name %] </td>
              [% '</tr>' IF loop.count % 2 == 0 %]
          [% END %]
     </table>

So, in that instance, I think having an "odd" (and an "even", natch) 
would make it more legible for the non-programmers.


Andy,

 > Yep, set the $Template::Config::ITERATOR package variable to contain
 > the name of your iterator module.

Excellent!  Sounds very simple.  Thanx for the tip.


		-- Buddy

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Overriding the default iterator
Buddy Burden 01:43 on 03 Sep 2004

Re: [Templates] Overriding the default iterator
Adam Kennedy 05:31 on 03 Sep 2004

Re: [Templates] Overriding the default iterator
Andy Wardley 06:53 on 03 Sep 2004

Re: [Templates] Overriding the default iterator
Buddy Burden 16:36 on 03 Sep 2004

RE: [Templates] Overriding the default iterator
Thomas, Mark - BLS CTR 17:06 on 03 Sep 2004

Re: [Templates] Overriding the default iterator
Buddy Burden 17:38 on 03 Sep 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52