Skip to content

Instantly share code, notes, and snippets.

Created August 13, 2010 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/522735 to your computer and use it in GitHub Desktop.
Save anonymous/522735 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use lib 'lib';
use Mojolicious::Lite;
get '/' => 'm000';
get '/000' => 'm000';
get '/001' => 'm001';
get '/010' => 'm010';
get '/011' => 'm011';
shagadelic('daemon');
__DATA__
@@ m0.html.ep
% layout 'default';
<% content 'menu0' => {%>
<ul>
<li<% if ($child eq 'm00') { %> class="active"<% } %>><a href="000.html">00</a></li>
<li<% if ($child eq 'm01') { %> class="active"<% } %>><a href="010.html">01</a></li>
</ul>
<%}%>
@@ m00.html.ep
% extends 'm0', child => 'm00';
<% content 'menu1' => {%>
<ul>
<li<% if ($child eq 'm000') { %> class="active"<% } %>><a href="000.html">000</a></li>
<li<% if ($child eq 'm001') { %> class="active"<% } %>><a href="001.html">001</a></li>
</ul>
<%}%>
@@ m01.html.ep
% extends 'm0', child => 'm01';
<% content 'menu1' => {%>
<ul>
<li<% if ($child eq 'm010') { %> class="active"<% } %>><a href="010.html">010</a></li>
<li<% if ($child eq 'm011') { %> class="active"<% } %>><a href="011.html">011</a></li>
</ul>
<%}%>
@@ m000.html.ep
% extends 'm00', child => 'm000';
<p>000</p>
@@ m001.html.ep
% extends 'm00', child => 'm001';
<p>001</p>
@@ m010.html.ep
% extends 'm01', child => 'm010';
<p>010</p>
@@ m011.html.ep
% extends 'm01', child => 'm011';
<p>011</p>
@@ layouts/default.html.ep
<html>
<head>
<style type="text/css">
li.active { background: #C0DEED; }
</style>
</head>
<body>
<table border="1">
<tr>
<td><%== content 'menu0' %></td>
<td rowspan="2"><%== content %></td>
</tr><tr>
<td><%== content 'menu1' %></td>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment