I have two macros, mostly similar:

        MACRO list_item_type_a(item) BLOCK;
                lots; of; common; calls;
                display_type_a(item);
                lots; more; common; calls;
                delete_link_for_type_a(item);
        END;

        MACRO list_item_type_a(item) BLOCK;
                lots; of; common; calls;
                display_type_b(item);
                lots; more; common; calls;
                delete_link_for_type_b(item);
        END;

I've played with various ways to factor this all out, none of which I've
been particularly happy with (mostly involving either splititng the
common calls out into another macro, thus making each of these be
"common_calls(item); display_type_X(item); more_common_calls(item)" or
by having a macro which takes 3 arguments:
  (item, result_of_display_type, result_of_correct_delete_link)

I suspect that this is the sort of thing that can be done nicely with a
VIEW, but the items are just hashrefs, not objects of different types,
so AFAICS I can't do the normal "Views as Data Presenter" delegation.

Any suggestions for the nicest way to do this sort of thing?

Tony


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to