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

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

user1078
1#
user1078 Published in May 21, 2018, 9:18 am

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.306346 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO