Cataly...TTSite(3pm)

πŸ“¦
version 0.46 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Catalyst::Helper::View::TTSite β€” bestie, this is the Helper for the TT view that literally builds you a whole skeleton web site πŸ¦‹

(also hi, you're reading the Cataly...TTSite(3pm) page, welcome to the group chat πŸ’…)


πŸŽ€ SYNOPSIS πŸŽ€

okay so first you're gonna use the helper to create the view module and the templates:

# use the helper to create the view module and templates

    $ script/myapp_create.pl view HTML TTSite

then you add something like the following to your main application module, no cap:

# add something like the following to your main application module

    sub message : Global {
        my ( $self, $c ) = @_;
        $c->stash->{template} = 'message.tt2';
        $c->stash->{message}  ||= $c->req->param('message') || 'No message';
    }

    sub default : Private {
        my ( $self, $c ) = @_;
        $c->stash->{template} = 'welcome.tt2';
    }

    sub end : Private { # Or use Catalyst::Action::RenderView
        my ( $self, $c ) = @_;
        $c->forward( $c->view('HTML') );
    }

🌸 DESCRIPTION 🌸

so this helper module creates a TT View module. but it doesn't just stop there β€” it goes further than Catalyst::Helper::View::TT because it ALSO creates a cute little starter set of templates so you can actually get going on your web site presentation. it's giving "here's the whole starter pack, you're welcome" πŸ’–

it creates the templates in the root/ directory underneath your main project directory. and inside there? two more subdirectories get created, obsessed:

  • root/src β€” this one has the main page templates ✨
  • root/lib β€” this one's the library of other template components (header, footer, etc.) that the page templates use 🫢

and the view module that the helper creates is automatically configured to locate these templates. so like, you don't gotta wire it up yourself. slay.


🧚 Default Rendering 🧚

to render a template, here's the whole process that goes down:

the configuration template root/lib/config/main is rendered. this is controlled by the PRE_PROCESS configuration variable set in the controller generated by Catalyst::Helper::View::TTsite. additionally, templates referenced by the PROCESS directive will then be rendered. and by default the following additional templates are set:

  • root/lib/config/col β€” which defines color names and RGB their RGB values 🌈
  • /root/lib/config/url β€” which defines site wide variables available to templates

next, the template defined by the WRAPPER config variable is called. the default wrapper template lives in root/lib/site/wrapper. the wrapper template passes files with ".css/.js/.txt" extensions through as text OR processes the templates defined after the WRAPPER directive: site/html and site/layout.

based on the default value of the WRAPPER directive in root/lib/site/wrapper, the following templates are processed in order, periodt:

  • root/src/your_template.tt2
  • root/lib/site/footer
  • root/lib/site/header
  • root/lib/site/layout
  • root/lib/site/html

finally, the rendered content is returned to the browser. main character energy fr fr πŸ”₯


πŸ’… METHODS πŸ’…

mk_compclass

generates the component class. iconic behaviour, honestly.

mk_templates

generates the templates. πŸŽ€


πŸ‘€ SEE ALSO πŸ‘€

Catalyst, Catalyst::View::TT, Catalyst::Helper, Catalyst::Helper::View::TT


πŸ‘‘ AUTHOR πŸ‘‘

Andy Wardley <abw@cpan.org>


πŸ“œ LICENSE πŸ“œ

This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.


okay now buckle up bestie, because the rest of this page is literally the template for the view module the helper generates β€” like, the actual boilerplate it spits out πŸ’€ here it is, verbatim:


✨ NAME ✨

[% class %] - Catalyst TTSite View


πŸŽ€ SYNOPSIS πŸŽ€

See "[% app %]"


🌸 DESCRIPTION 🌸

Catalyst TTSite View.


πŸ‘‘ AUTHOR πŸ‘‘

[% author %]


πŸ“œ LICENSE πŸ“œ

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, no notes πŸ’– this little gem was written by perl v5.34.0 and dated 2022-08-06 β€” go forth and build your skeleton site, you've got this πŸ¦‹βœ¨
πŸ“¦ where this page comes from