>>>>> "Dave" == Dave Howorth <[email protected]> writes:
    Dave> Well, I've made this template code work:

    Dave>  items = some_resultset_rs.all_ref ;
    Dave>  IF items.0;
    Dave>    '<ul>' ;
    Dave>    FOREACH item IN items ;
    Dave>      '<li>' ; item.name ;
    Dave>    END ;
    Dave>    '</ul>' ;
    Dave>  END ;

    Dave> by dint of a naughty line of perl:

    Dave>  *DBIx::Class::ResultSet::all_ref = sub { [ shift->all ] };

    Dave> Any better ideas?

You should be able to do:

--8<---------------cut here---------------start------------->8---
[% FOREACH item IN resultset_rs.all.list %]
--8<---------------cut here---------------end--------------->8---

The docs for the list scalar vmethod in Template::Manual::VMethod say:

"This can be useful if you have a variable which may contain a single
item or a list."

-- 
   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://blog.edencardim.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to