This is passed to the template, which then does this:sub get_variant_measurements { my $resultset = shift; my $variant_id = @_; my $variant_measurements = $resultset->search_related( 'variant_measurements', { }, { 'order_by' => ['variant_id','measurement_id'] }, ); return $variant_measurements; }
Little hard to work out from the current context, what the db calls done previously in a loop in the template are now carried out in one database call in the handler.[% WHILE ( type_measurement = type_measurements.next ) %] <tr> [% WHILE (variant_measurement = variant_measurements.next) %] [% IF variant_measurement.measurement_id == type_measurement.measure +ment_id %] <td> <input type="text" size="3" name="measure-[% variant_measurement.variant_id %]-[% typ +e_measurement.measurement.measurement %]" value="[% variant_measurement.value %]" /> </td> [% END %] [% END %] </tr> [% END %]
In reply to Re^3: Methods in template toolkit
by dariusj
in thread Methods in template toolkit
by dariusj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |