trying to use the HTMLTemplateProRenderer
plugin for
Mojolicious::Lite
so that I can use template files in the style of HTML::Template
.
The issue is that every example, even documentation, only shows the template file attached to the script. I need the template file to be in a different directory from the Perl code.
Here is a sample of what I am trying to do.
This works using __DATA__
, but how could it work by using an external template file as this:
#!/usr/bin/env perl
use Mojolicious::Lite;
plugin 'HTMLTemplateProRenderer';
# Route leading to an action that renders a template
get '/test' => sub {
my $c = shift;
$c->stash( one => 'This is result one' );
$c->render(
template => 'display/index',
two => 'this is the second',
handler => 'tmpl'
);
};
app->start;
The template file is display/index.tmpl
<html>
<head><title>Test Template</title>
<body>
<p>Value ONE = <TMPL_VAR NAME="one"> </p>
<p>Value TWO = <TMPL_VAR NAME="two"> </p>
</body>
</html>