Browse files

Configure View::HTML to use wrapper.tt2 and basic CSS

  • Loading branch information...
1 parent f4c74e1 commit 5e316ee3c0487d563a90f4d20c266052d65c3774 @phillipadsmith committed Aug 15, 2011
Showing with 79 additions and 0 deletions.
  1. +2 −0 lib/Catalyst/Default/View/HTML.pm
  2. +40 −0 root/src/wrapper.tt2
  3. +37 −0 root/static/css/main.css
View
2 lib/Catalyst/Default/View/HTML.pm
@@ -9,6 +9,8 @@ __PACKAGE__->config(
# Change default TT extension
TEMPLATE_EXTENSION => '.tt2',
render_die => 1,
+ # This is your wrapper template located in the 'root/src'
+ WRAPPER => 'wrapper.tt2',
);
=head1 NAME
View
40 root/src/wrapper.tt2
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>[% template.title or "My Catalyst App!" %]</title>
+<link rel="stylesheet" href="[% c.uri_for('/static/css/main.css') %]" />
+</head>
+
+<body>
+<div id="outer">
+<div id="header">
+ [%# Your logo could go here -%]
+ <img src="[% c.uri_for('/static/images/btn_88x31_powered.png') %]" />
+ [%# Insert the page title -%]
+ <h1>[% template.title or site.title %]</h1>
+</div>
+
+<div id="bodyblock">
+<div id="menu">
+ Navigation:
+ <ul>
+ <li><a href="[% c.uri_for('/books/list') %]">Home</a></li>
+ <li><a href="[% c.uri_for('/') %]" title="Catalyst Welcome Page">Welcome</a></li>
+ </ul>
+</div><!-- end menu -->
+
+<div id="content">
+ [%# Status and error messages %]
+ <span class="message">[% status_msg %]</span>
+ <span class="error">[% error_msg %]</span>
+ [%# This is where TT will stick all of your template's contents. -%]
+ [% content %]
+</div><!-- end content -->
+</div><!-- end bodyblock -->
+
+<div id="footer">Copyright (c) your name goes here</div>
+</div><!-- end outer -->
+
+</body>
+</html>
View
37 root/static/css/main.css
@@ -0,0 +1,37 @@
+#header {
+ text-align: center;
+}
+#header h1 {
+ margin: 0;
+}
+#header img {
+ float: right;
+}
+#footer {
+ text-align: center;
+ font-style: italic;
+ padding-top: 20px;
+}
+#menu {
+ font-weight: bold;
+ background-color: #ddd;
+}
+#menu ul {
+ list-style: none;
+ float: left;
+ margin: 0;
+ padding: 0 0 50% 5px;
+ font-weight: normal;
+ background-color: #ddd;
+ width: 100px;
+}
+#content {
+ margin-left: 120px;
+}
+.message {
+ color: #390;
+}
+.error {
+ color: #f00;
+}
+

0 comments on commit 5e316ee

Please sign in to comment.