Skip Menu |

This queue is for tickets about the Maypole CPAN distribution.

Report information
The Basics
Id: 13447
Status: resolved
Priority: 0/
Queue: Maypole

People
Owner: Nobody in particular
Requestors: info [...] whawes.co.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.09
Fixed in: 2.10



Subject: Multiple template paths
Here is a patch for Maypole::View::Base to allow the specification of multiple template paths in template_root(). This functionality has been requested before on the mailing list. It is useful when you want to serve header, footer, etc from site A while defaulting to site B for templates such as "list", "view", etc. This patch should be fully backward compatible. I have been using it for several weeks without problems.
--- Base_orig.pm Tue Jun 28 13:48:19 2005 +++ Base.pm Tue Jun 28 13:49:25 2005 @@ -10,15 +10,22 @@ sub paths { my ( $self, $r ) = @_; my $root = $r->config->template_root || $r->get_template_root; - return ( - $root, - ( - $r->model_class - && File::Spec->catdir( $root, $r->model_class->moniker ) - ), - File::Spec->catdir( $root, "custom" ), - File::Spec->catdir( $root, "factory" ) - ); + if(ref($root) ne 'ARRAY') { + $root = [ $root ]; + } + my @output = (); + foreach my $path (@$root) { + push(@output, $path); + push(@output, + ( + $r->model_class + && File::Spec->catdir( $path, $r->model_class->moniker ) + ) + ); + push(@output, File::Spec->catdir( $path, "custom" )); + push(@output, File::Spec->catdir( $path, "factory" )); + } + return @output; } sub vars {
From: TeeJay
[guest - Tue Jun 28 08:53:30 2005]: Show quoted text
> Here is a patch for Maypole::View::Base to allow the specification of > multiple template paths in template_root(). > > This functionality has been requested before on the mailing list. It > is useful when you want to serve header, footer, etc from site A > while defaulting to site B for templates such as "list", "view", > etc. > > This patch should be fully backward compatible. I have been using it > for several weeks without problems.
Applied to SVN : revision 339