Home Mojolicious::Lite External Templates "Template 'template.html.ep' not found
Reply: 0

Mojolicious::Lite External Templates "Template 'template.html.ep' not found

gregnnylf94
1#
gregnnylf94 Published in 2018-01-10 18:54:42Z

I have a very simple Mojolicious::Lite application that displays a form.

When I embed the HTML at the bottom of the script it works fine, but when I try to put my templates in a ./templates folder and my layouts in the ./templates/layouts folder I get the error

Template 'template_name.html.ep' not found

I followed the guide from here

I also tried adding the @@ template_name.html.ep to the top of each file.

Am I doing something obviously wrong?

Application/index.pl

#! C:\strawberry\perl\bin\perl.exe
use Mojolicious::Lite;

any '/' => sub {
    my $self = shift;
    $self->render(template => 'home/index');
};

app->start;

Application/templates/home/index.html.ep

@@ home/index.html.ep
% layout 'default';
Hello Hello Hello

Application/templates/layouts/default.html.ep

(A bunch of HTML with a <%= content %> tag)

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298092 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO