FAQ
Dear All,

I am trying to automatically add a Header template and footer template to
all templates for any controller, so as not to have a include in each
controller template.

I read about PRE_PROCESS to put a header on, but what would you recommend
for adding a footer to all templates? Something to do with WRAPPER?

Thanks,

Gavin.

--
Walking the road to enlightenment... I found a penguin and a camel on the
way..... Fancy a yourname at perl.me.uk? Just ask!!!
http://perlmonks.org/?node_id86673

Search Discussions

  • Denis at Mar 25, 2006 at 10:44 am
    myapp.yml
    View::TT:
    WRAPPER: 'wrapper.tt'


    wrapper.tt

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>
    [% appname %]
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link title="Maypole" href="[%base%]static/pagingandsort.css" type="text/css" rel="stylesheet"/>
    </head>
    <body>
    <div class="content">
    [% content %]
    </div>
    </body>
    </html>

    Dear All,
    I am trying to automatically add a Header template and footer template to
    all templates for any controller, so as not to have a include in each
    controller template.
    I read about PRE_PROCESS to put a header on, but what would you recommend
    for adding a footer to all templates? Something to do with WRAPPER?
    Thanks,
    Gavin.
  • Gavin Henry at Mar 25, 2006 at 3:55 pm
    <quote who="denis at uzvik.kiev.ua">
    myapp.yml
    View::TT:
    WRAPPER: 'wrapper.tt'


    wrapper.tt

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>
    [% appname %]
    </title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8"/>
    <link title="Maypole" href="[%base%]static/pagingandsort.css"
    type="text/css" rel="stylesheet"/>
    </head>
    <body>
    <div class="content">
    [% content %]
    </div>
    </body>
    </html>
    Many thanks.

    I take it [% content %] is the template in $c->{stash}->{template} or
    similar?

    Gavin.
    Dear All,
    I am trying to automatically add a Header template and footer template
    to
    all templates for any controller, so as not to have a include in each
    controller template.
    I read about PRE_PROCESS to put a header on, but what would you
    recommend
    for adding a footer to all templates? Something to do with WRAPPER?
    Thanks,
    Gavin.




    _______________________________________________
    Catalyst mailing list
    Catalyst at lists.rawmode.org
    http://lists.rawmode.org/mailman/listinfo/catalyst
  • Matt S Trout at Mar 25, 2006 at 4:03 pm

    Gavin Henry wrote:
    <quote who="denis at uzvik.kiev.ua">
    myapp.yml
    View::TT:
    WRAPPER: 'wrapper.tt'


    wrapper.tt

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>
    [% appname %]
    </title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8"/>
    <link title="Maypole" href="[%base%]static/pagingandsort.css"
    type="text/css" rel="stylesheet"/>
    </head>
    <body>
    <div class="content">
    [% content %]
    </div>
    </body>
    </html>
    Many thanks.

    I take it [% content %] is the template in $c->{stash}->{template} or
    similar?
    perldoc Template::Manual::Directives

    --
    Matt S Trout Offering custom development, consultancy and support
    Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
    Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information

    + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
  • Aristotle Pagaltzis at Mar 25, 2006 at 4:06 pm
    Hi Gavin,

    * Gavin Henry [2006-03-25 17:00]:
    I take it [% content %] is the template in
    $c->{stash}->{template} or similar?
    no, it?s the processed output of the wrapped template. See
    Template::Manual::Config under `WRAPPER` for how it works.

    Regards,
    --
    Aristotle Pagaltzis // <http://plasmasturm.org/>
  • Jason Kohles at Mar 25, 2006 at 1:08 pm

    On 3/25/06, Gavin Henry wrote:
    Dear All,

    I am trying to automatically add a Header template and footer template to
    all templates for any controller, so as not to have a include in each
    controller template.

    I read about PRE_PROCESS to put a header on, but what would you recommend
    for adding a footer to all templates? Something to do with WRAPPER?
    Check out Catalyst::Helper::View::TTSite, which will create a TT view
    for you complete with headers, footers, css, and some example pages...
    The templates it gives you also demonstrate some handy things like
    how to avoid your wrapper being applied if you are generating
    javascript or css from templates...

    --
    Jason Kohles
    email at jasonkohles.com - http://www.jasonkohles.com/
    "A witty saying proves nothing." -- Voltaire
  • Gavin Henry at Mar 25, 2006 at 3:57 pm
    <quote who="Jason Kohles">
    On 3/25/06, Gavin Henry wrote:
    Dear All,

    I am trying to automatically add a Header template and footer template
    to
    all templates for any controller, so as not to have a include in each
    controller template.

    I read about PRE_PROCESS to put a header on, but what would you
    recommend
    for adding a footer to all templates? Something to do with WRAPPER?
    Check out Catalyst::Helper::View::TTSite, which will create a TT view
    for you complete with headers, footers, css, and some example pages...
    The templates it gives you also demonstrate some handy things like
    how to avoid your wrapper being applied if you are generating
    javascript or css from templates...
    Cheers. That was another one on my list to visit ;-)
    --
    Jason Kohles
    email at jasonkohles.com - http://www.jasonkohles.com/
    "A witty saying proves nothing." -- Voltaire

    _______________________________________________
    Catalyst mailing list
    Catalyst at lists.rawmode.org
    http://lists.rawmode.org/mailman/listinfo/catalyst

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 25, '06 at 9:56a
activeMar 25, '06 at 4:06p
posts7
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase