That 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 => 23);
$c->render(template => 'index', two => 24, handler => 'tmpl');
};
app->start;
Here is the external in templates/index.tmpl file:
<html>
<head><title>Test Template</title>
<body>
Value ONE = <TMPL_VAR one>
<p>
Value TWO = <TMPL_VAR two>
</body>
</html>
Thanks! |