Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###########################################################################
- # Captured Content
- # The content_for helper can be used to build content references to be used
- # later.
- # /captured
- get '/captured' => sub {
- my $self = shift;
- $self->content_for('body_header' => 'My content_for demo');
- $self->render('captured');
- };
- # Captured content
- @@ captured.html.ep
- % layout 'blue', title => 'Blue';
- % content_for header => begin
- <meta http-equiv="Pragma" content="no-cache">
- % end
- Hello World!
- % content_for body_footer => begin
- <hr />
- Captured Content
- % end
- % content_for header => begin
- <meta http-equiv="Expires" content="-1">
- % end
- @@ layouts/blue.html.ep
- <!DOCTYPE html>
- <html>
- <head>
- <title><%= title %></title>
- %= content_for 'header'
- </head>
- <body>
- <%= content_for 'body_header' %><hr />
- <%= content %>
- <hr /><%= content_for 'body_footer' %>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement