The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SweetPea::Application::Template - Template handling for SweetPea-Application.

SYNOPSIS

    ... from inside SweetPea::Application or a Controller;
    $s->template->render('/index');
    $s->template->render({ template => '/newletter', layout => '/email'});
    $s->template->render('/index')->to('content');
    $s->template->render('/layouts/default');

METHODS

new

    The new method instantiates a new SweetPea::Application::Template object
    which use Template as a base class to provide methods for rendering
    data and documents using templates.
    
    $s->plug('template', sub {return SweetPea::Application::Template->new($s)});

clear

    The clear method resets all data variables pertaining to the template
    in its present context. The clear method is called automatically after
    processing the "to" method.
    
    $s->template->clear;

render

    The render method prepares a template document for parsing.
    
    $s->template->render('/index');
    $s->template->render({ template => '/newletter', layout => '/email'});

to

    The "to" method renders the template in its present context to a special
    area in the sweetpea application stash(store) for template identified by
    the label passed in.
    
    $s->template->render('/dashboard')->to('main');
    $s->template->render('/options')->to('sidebar');
    $s->template->render('/layouts/default')->to;

AUTHOR

Al Newkirk, <al.newkirk at awnstudio.com>