line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::View::TT::Layout; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
34558
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
6
|
use base 'Catalyst::View::TT'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
862
|
|
5
|
1
|
|
|
1
|
|
2387
|
use NEXT; |
|
1
|
|
|
|
|
33751
|
|
|
1
|
|
|
|
|
180
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub process { |
10
|
0
|
|
|
0
|
1
|
|
my ( $self, $c ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
0
|
|
|
|
$c->stash->{template_layout} ||= []; |
13
|
0
|
|
|
|
|
|
my @layouts = ( @{$c->stash->{template_layout}}, $c->stash->{template} ); |
|
0
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
$c->stash->{LAYOUTS} = \@layouts; |
15
|
0
|
|
|
|
|
|
$c->stash->{template} = shift @layouts; |
16
|
0
|
|
|
|
|
|
return $self->NEXT::process($c); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Catalyst::View::TT::Layout - Layout TT template processing |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
in the appliction: |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$c->stash->{template_layout} = [ 'main_layout.tpl', 'sub_layout.tpl' ]; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
in the template files ('main_layout.tpl' and 'sub_layout.tpl'): |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
[% PROCESS $LAYOUTS.shift %] |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
A Layout version of the Catalyst TT view. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 OVERRIDDEN METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over 4 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item process |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Overrides C<process> to let template could be layout. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SEE ALSO |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
L<Catalyst>. L<Catalyst::View::TT> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Chunzi, C<chunzi@chunzi.org> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 THANK YOU |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
SRI, for writing the awesome Catalyst framework |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 COPYRIGHT |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
64
|
|
|
|
|
|
|
the same terms as Perl itself. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |