Advertisement
Guest User

Untitled

a guest
Nov 29th, 2011
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.90 KB | None | 0 0
  1. ###########################################################################
  2. # Captured Content
  3. # The content_for helper can be used to build content references to be used
  4. # later.
  5. # /captured
  6. get '/captured' => sub {
  7.   my $self = shift;
  8.   $self->content_for('body_header' => 'My content_for demo');
  9.   $self->render('captured');
  10. };
  11.  
  12.  
  13. # Captured content
  14. @@ captured.html.ep
  15. % layout 'blue', title => 'Blue';
  16. % content_for header => begin
  17.   <meta http-equiv="Pragma" content="no-cache">
  18. % end
  19. Hello World!
  20. % content_for body_footer => begin
  21. <hr />
  22. Captured Content
  23. % end
  24. % content_for header => begin
  25.   <meta http-equiv="Expires" content="-1">
  26. % end
  27.  
  28. @@ layouts/blue.html.ep
  29. <!DOCTYPE html>
  30. <html>
  31. <head>
  32.   <title><%= title %></title>
  33.   %= content_for 'header'
  34. </head>
  35. <body>
  36.     <%= content_for 'body_header' %><hr />
  37.     <%= content %>
  38.     <hr /><%= content_for 'body_footer' %>
  39. </body>
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement