Re: [Maypole-dev] Patch: vastly increased TT speed

From: Simon Flack (sf at flacks.net)
Date: Tue Nov 30 2004 - 16:13:00 GMT


Perrin Harkins wrote:
> On Tue, 2004-11-30 at 11:52 +0000, Simon Flack wrote:
>
>> sub template {
>> my $self = shift;
>> local $Template::Stash::LIST_OPS{sort_by_rank} = \&sort_by_rank;
>> local $Template::Stash::LIST_OPS{sort_by_name} = \&sort_by_name;
>> ...
>> $self->SUPER::template(@_);
>> }
>
> [...]
>
>>Aside from the fact that I may be missing a much simpler way of doing
>>this in TT
>
>
> You can probably just use the sort/nsort list methods in your template:
>
> [% FOREACH thing = things.nsort('rank') %]
>

Thanks, I'll try that.

I saw the hash sort/nsort methods documented in
Template::Manual::VMethods, but not the list methods. I did say I was
probably missing something obvious!

>>So we
>>could give each view object its own Template object (rather than sharing
>>them for all Maypole apps).
>
>
> If you do that, you may want to share one Template::Provider object
> between them so that the cache will be shared.

Thanks for the tip.

Simon

_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT