++ed by:

1 non-PAUSE user.

Ferruccio Zamuner
and 1 contributors


Catalyst::Helper::View::Bootstrap - Helper for Twitter Bootstrap and TT view which builds a skeleton web site


# use the helper to create the view module and templates

    $ script/myapp_create.pl view HTML Bootstrap

# 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 index : Path : Args(0) {
        my ( $self, $c ) = @_;
        $c->stash->{template} = 'welcome.tt2';

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


This helper module creates a TT View module. It goes further than Catalyst::Helper::View::TT in that it additionally creates a simple set of templates to get you started with your web site presentation using Twitter Bootstrap3 from a CDN (Content Delivery Network).

It creates the templates in root/ directory underneath your main project directory. In here two further subdirectories are created: root/src which contains the main page templates, and root/lib containing a library of other template components (header, footer, etc.) that the page templates use.

The view module that the helper creates is automatically configured to locate these templates.

It sets character encoding to utf-8 and it delivers HTML5 pages.

Now you can set BOOTSTRAP_THEME in stash and it will load also bootstrap-theme.css

Default Rendering

To render a template the following process is applied:

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::Bootstrap. Additionally, templates referenced by the PROCESS directive will then be rendered.

Next, the template defined by the WRAPPER config variable is called. The default wrapper template is located 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:

  • root/src/your_template.tt2

  • root/lib/site/footer

  • root/lib/site/header

  • root/lib/site/sidemenu

  • root/lib/site/layout

  • root/lib/site/html

Finally, the rendered content is returned to the bowser.



Generates the component class.


Generates the templates.


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


Ferruccio Zamuner <nonsolosoft@diff.org> Juan Paredes Colin Keith <colinmkeith@gmail.com>


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


[% class %] - Catalyst TT Twitter Bootstrap View


See "[% app %]"


Catalyst TTSite View.


[% author %]


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