El'Drako
2013-01-13 09:30:03 UTC
Hi,
I just got acquainted with Mojolicious, respectively I have questions.
have this code:
# Application
use utf8;
...
sub startup {
my $self = shift;
$self->secret('fggwgwrggowifjwh7437hqnva7o');
...
my $r = $self->routes;
$r->get('/')->to('main#index');
}
# SIP/main.pm
package SIP::Main;
use Mojo::Base 'Mojolicious::Controller';
# This action will render a template
sub index {
my $self = shift;
# Render template "main/index.html.ep" with message
$self->render(title => 'test');
}
#templates
# main/index.html.ep
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%= $title %></title>
</head>
<body>
<div id="container">
%= include 'main/mainmenu'
%= include 'main/header'
<div id="content">
%= include 'main/leftsidebar'
<div id="content_right">
%= include 'main/content'
</div> <!-- end of content right -->
<div class="cleaner_with_height"> </div>
</div> <!-- end of content -->
%= include 'main/footer'
</div> <!-- end of container -->
</body>
</html>
# main/heder.html.ep
<div id="logon">
<a href="/" style=""><%= $logon %></a><br/>
<small><%= $sublogon %></small>
</div>
and etc...
disappears.
how to work with templates from multiple files?
P.S. Sorry for my bad English.
I just got acquainted with Mojolicious, respectively I have questions.
have this code:
# Application
package SIP;
use Mojo::Base 'Mojolicious';use utf8;
...
sub startup {
my $self = shift;
$self->secret('fggwgwrggowifjwh7437hqnva7o');
...
my $r = $self->routes;
$r->get('/')->to('main#index');
}
# SIP/main.pm
package SIP::Main;
use Mojo::Base 'Mojolicious::Controller';
# This action will render a template
sub index {
my $self = shift;
# Render template "main/index.html.ep" with message
$self->render(title => 'test');
}
#templates
# main/index.html.ep
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%= $title %></title>
</head>
<body>
<div id="container">
%= include 'main/mainmenu'
%= include 'main/header'
<div id="content">
%= include 'main/leftsidebar'
<div id="content_right">
%= include 'main/content'
</div> <!-- end of content right -->
<div class="cleaner_with_height"> </div>
</div> <!-- end of content -->
%= include 'main/footer'
</div> <!-- end of container -->
</body>
</html>
# main/heder.html.ep
<div id="logon">
<a href="/" style=""><%= $logon %></a><br/>
<small><%= $sublogon %></small>
</div>
and etc...
Bad signed cookie "mojolicious", possible hacking attempt.
if remove the %include and make a template in one file, the messagedisappears.
how to work with templates from multiple files?
P.S. Sorry for my bad English.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mojolicious/-/1B8v7chvwasJ.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mojolicious/-/1B8v7chvwasJ.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.