![]() |
![]()
| ![]() |
![]()
NAMEDancer2::Core::Role::Template - Role for template engines VERSIONversion 1.1.2 DESCRIPTIONAny class that consumes this role will be able to be used as a template engine under Dancer2. In order to implement this role, the consumer must implement the method "render". This method will receive three arguments:
Any template receives the following tokens, by default:
ATTRIBUTESnameThe name of the template engine (e.g.: Simple). charsetThe charset. The default value is UTF-8. default_tmpl_extThe default file extension. If not provided, tt is used. viewsPath to the directory containing the views. layoutPath to the directory containing the layouts. layout_dirRelative path to the layout directory. Default: layouts. engineContains the engine. METHODSview_pathname($view)Returns the full path to the requested view. layout_pathname($layout)Returns the full path to the requested layout. pathname_exists($pathname)Returns true if the requested pathname exists. Can be used for either views or layouts: $self->pathname_exists( $self->view_pathname( 'some_view' ) ); $self->pathname_exists( $self->layout_pathname( 'some_layout' ) ); render_layout($layout, \%tokens, \$content)Render the layout with the applied tokens apply_renderer($view, \%tokens)apply_layout($content, \%tokens, \%options)process($view, \%tokens, \%options)template($view, \%tokens, \%options)AUTHORDancer Core Developers COPYRIGHT AND LICENSEThis software is copyright (c) 2024 by Alexis Sukrieh. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|