1Catalyst::View::ComponeUnste:r:SCuobnItnrcilbuudtee(d3C)PaetrallyDsotc:u:mVeinetwa:t:iCoonmponent::SubInclude(3)
2
3
4

NAME

6       Catalyst::View::Component::SubInclude - Use subincludes in your
7       Catalyst views
8

VERSION

10       Version 0.10
11

SYNOPSIS

13         package MyApp::View::TT;
14         use Moose;
15
16         extends 'Catalyst::View::TT';
17         with 'Catalyst::View::Component::SubInclude';
18
19         __PACKAGE__->config( subinclude_plugin => 'SubRequest' );
20
21       Then, somewhere in your templates:
22
23         [% subinclude('/my/widget') %]
24         [% subinclude_using('SubRequest', '/page/footer') %]
25

DESCRIPTION

27       "Catalyst::View::Component::SubInclude" allows you to include content
28       in your templates (or, more generally, somewhere in your view's
29       "render" processing) which comes from another action in your
30       application. It's implemented as a Moose::Role, so using Moose in your
31       view is required.
32
33       Simply put, it's a way to include the output of a Catalyst sub-request
34       somewhere in your page.
35
36       It's built in an extensible way so that you're free to use sub-
37       requests, Varnish ESI
38       (<http://www.catalystframework.org/calendar/2008/17>) or any other sub-
39       include plugin you might want to implement.
40

STASH FUNCTIONS

42       This component does its magic by exporting a "subinclude" coderef entry
43       to the stash. This way, it's easily accessible by the templates (which
44       is the most common use-case).
45
46   "subinclude( $path, @args )"
47       This will render and return the body of the included resource (as
48       specified by $path) using the default subinclude plugin.
49
50   "subinclude_using( $plugin, $path, @args )"
51       This will render and return the body of the included resource (as
52       specified by $path) using the specified subinclude plugin.
53
54       The "subinclude" function above is implemented basically as a shortcut
55       which calls this function using the default plugin as the first
56       parameter.
57

SUBINCLUDE PLUGINS

59       The module comes with two subinclude plugins: SubRequest, Visit and
60       ESI.
61
62       By default, the "SubRequest" plugin will be used. This can be changed
63       in the view's configuration options (either in the config file or in
64       the view module itself).
65
66       Configuration file example:
67
68         <View::TT>
69             subinclude_plugin   ESI
70         </View::TT>
71
72   "set_subinclude_plugin( $plugin )"
73       This method changes the current active subinclude plugin in runtime. It
74       expects the plugin suffix (e.g. "ESI" or "SubRequest") or a fully-
75       qualified class name in the "Catalyst::View::Component::SubInclude"
76       namespace.
77
78   Writing plugins
79       If writing your own plugin, keep in kind plugins are required to
80       implement a class method "generate_subinclude" with the following
81       signature:
82
83         sub generate_subinclude {
84             my ($class, $c, @args) = @_;
85         }
86
87       The default plugin is stored in the "subinclude_plugin" which can be
88       changed in runtime. It expects a fully qualified class name.
89

SEE ALSO

91       Catalyst::Plugin::SubRequest, Moose::Role, Moose,
92       <http://www.catalystframework.org/calendar/2008/17>
93

BUGS

95       Please report any bugs or feature requests to
96       "bug-catalyst-view-component-subinclude at rt.cpan.org", or through the
97       web interface at
98       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-Component-SubInclude>.
99       I will be notified, and then you'll automatically be notified of
100       progress on your bug as I make changes.
101

AUTHOR

103       Nilson Santos Figueiredo Junior, "<nilsonsfj at cpan.org>"
104

CONTRIBUTORS

106       Tomas Doran (t0m) "<bobtfish@bobtfish.net".
107
108       Vladimir Timofeev, "<vovkasm at gmail.com>".
109
110       Wallace Reis (wreis) "<wreis@cpan.org>".
111

SPONSORSHIP

113       Development sponsored by Ionzero LLC <http://www.ionzero.com/>.
114
116       Copyright (C) 2010 Nilson Santos Figueiredo Junior and the above
117       contributors.
118
119       Copyright (C) 2009 Nilson Santos Figueiredo Junior.
120
121       Copyright (C) 2009 Ionzero LLC.
122
123       This program is free software; you can redistribute it and/or modify it
124       under the same terms as Perl itself.
125
126
127
128perl v5.32.1                      2021-C0a1t-a2l6yst::View::Component::SubInclude(3)
Impressum