The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Egg::View::Template - HTML::Template for Egg view.

SYNOPSIS

  __PACKAGE__->_egg_config(
  
    VIEW => [
      [ Template => {
        path  => [qw{ <$e.template> <$e.comp> }],
        cache             => 1,
        global_vars       => 1,
        die_on_bad_params => 0,
        ... etc.
        } ],
      ],
  
    );

  # The VIEW object is acquired.
  my $view= $e->view('Template');
  
  # Associate is set.
  $view->push_associate( $object );
  
  # Filter is set.
  $view->push_filter( $filter );
  
  # It outputs it specifying the template.
  my $content= $view->render('hoge.tmpl', \%option);

DESCRIPTION

It is VIEW to use HTML::Template.

Please add the setting of VIEW to the project to use it.

  VIEW => [
    [ Template => { ... HTML::Template option. (HASH) } ],
    ],

* Please refer to the document of HTML::Template for the option to set.

METHODS

new

When $e->view('Template') is called, this constructor is called.

Please set %Egg::View::PARAMS directly from the controller to the parameter that wants to be set globally.

  %Egg::View::PARAMS= ( %Egg::View::PARAMS, %NewPARAM );

Some default parameters are set by Egg::View::Template::Params.

params, param

The parameter that wants to be passed to HTML::Template must use these methods.

push_filter ( [FILTER] )

The filter is set.

  • Alias: filter

push_associate ( [OBJECT] )

associate ‚É“n‚· OBJECT ‚ðƒZƒbƒg‚µ‚Ü‚·�B

  • Alias: associate

render ( [TEMPLATE], [OPTION] )

TEMPLATE is evaluated and the output result (SCALAR reference) is returned.

It is given priority more than VIEW set of default when OPTION is passed.

  my $body= $view->render( 'foo.tmpl', [OPTON_HASH] );

output ( [TEMPLATE], [OPTION] )

The output result of the receipt from 'render' method is set in $e->response->body.

When TEMPLATE is omitted, acquisition is tried from $view->template. see Egg::View.

If this VIEW operates as default_view, this method is called from '_dispatch_action' etc. by Egg.

  $view->output;

SEE ALSO

HTML::Template, Egg::View, Egg::Template::Param, Egg::Release,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT

Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 110:

Non-ASCII character seen before =encoding in '‚É“n‚·'. Assuming CP1252