On 05/24/2012 02:53 PM, Theunis De Klerk wrote:


As an example, how does this work for you :

my @rows_factory;
while ( my @factory_data = $sth->fetchrow_array() )
{
push @rows_factory, {'id' => $factory_data[0], 'abbr' => $factory_data[1]};
}

I normally do that when I want to do this in the template :

<select name="factory">
[% FOREACH factory IN factories %]
<option value="[% factory.id %]" size="20">[% factory.abbr %]</option>
[% END %]
</select>


I'm an idiot. It works now. I had some issues with the FOREACH line. My 'factories' data was actually under the array @factory. Since I'm still new to the toolkit, I got my variable names all screwed up. It is a good reminder to not have duplicate or similar variable names. Especially for me and my ADHD.

Thanks again.

--

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux 3.3.7-1.fc16.x86_64 GNU/Linux

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to