1Catalyst::Helper::View:U:sTeTrSiCtoen(t3r)ibuted Perl DoCcautmaelnytsatt:i:oHnelper::View::TTSite(3)
2
3
4
6 Catalyst::Helper::View::TTSite - Helper for TT view which builds a
7 skeleton web site
8
10 # use the helper to create the view module and templates
11
12 $ script/myapp_create.pl view HTML TTSite
13
14 # add something like the following to your main application module
15
16 sub message : Global {
17 my ( $self, $c ) = @_;
18 $c->stash->{template} = 'message.tt2';
19 $c->stash->{message} ||= $c->req->param('message') || 'No message';
20 }
21
22 sub default : Private {
23 my ( $self, $c ) = @_;
24 $c->stash->{template} = 'welcome.tt2';
25 }
26
27 sub end : Private { # Or use Catalyst::Action::RenderView
28 my ( $self, $c ) = @_;
29 $c->forward( $c->view('HTML') );
30 }
31
33 This helper module creates a TT View module. It goes further than
34 Catalyst::Helper::View::TT in that it additionally creates a simple set
35 of templates to get you started with your web site presentation.
36
37 It creates the templates in root/ directory underneath your main
38 project directory. In here two further subdirectories are created:
39 root/src which contains the main page templates, and root/lib
40 containing a library of other template components (header, footer,
41 etc.) that the page templates use.
42
43 The view module that the helper creates is automatically configured to
44 locate these templates.
45
46 Default Rendering
47 To render a template the following process is applied:
48
49 The configuration template root/lib/config/main is rendered. This is
50 controlled by the "PRE_PROCESS" configuration variable set in the
51 controller generated by Catalyst::Helper::View::TTsite. Additionally,
52 templates referenced by the "PROCESS" directive will then be rendered.
53 By default the following additional templates are set:
54 root/lib/config/col, which defines color names and RGB their RGB values
55 and /root/lib/config/url, which defines site wide variables available
56 to templates.
57
58 Next, the template defined by the "WRAPPER" config variable is called.
59 The default wrapper template is located in root/lib/site/wrapper. The
60 wrapper template passes files with ".css/.js/.txt" extensions through
61 as text OR processes the templates defined after the "WRAPPER"
62 directive: "site/html" and "site/layout".
63
64 Based on the default value of the "WRAPPER" directive in
65 root/lib/site/wrapper, the following templates are processed in order:
66
67 • root/src/your_template.tt2
68
69 • root/lib/site/footer
70
71 • root/lib/site/header
72
73 • root/lib/site/layout
74
75 • root/lib/site/html
76
77 Finally, the rendered content is returned to the browser.
78
80 mk_compclass
81 Generates the component class.
82
83 mk_templates
84 Generates the templates.
85
87 Catalyst, Catalyst::View::TT, Catalyst::Helper,
88 Catalyst::Helper::View::TT
89
91 Andy Wardley <abw@cpan.org>
92
94 This library is free software. You can redistribute it and/or modify it
95 under the same terms as perl itself.
96
98 [% class %] - Catalyst TTSite View
99
101 See "[% app %]"
102
104 Catalyst TTSite View.
105
107 [% author %]
108
110 This library is free software. You can redistribute it and/or modify it
111 under the same terms as Perl itself.
112
113
114
115perl v5.34.0 2021-07-22 Catalyst::Helper::View::TTSite(3)