Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add template for /books/list action

  • Loading branch information...
commit 268cac856cdaa1995a15f4f83da3abe2f91d40ab 1 parent 33a2527
Phillip Smith authored August 15, 2011
6  lib/Catalyst/Default.pm
@@ -40,6 +40,12 @@ __PACKAGE__->config(
40 40
     name => 'Catalyst::Default',
41 41
     # Disable deprecated behavior needed by old applications
42 42
     disable_component_resolution_regex_fallback => 1,
  43
+    'View::HTML' => {
  44
+        #Set the location for TT files
  45
+        INCLUDE_PATH => [
  46
+            __PACKAGE__->path_to( 'root', 'src' ),
  47
+        ],
  48
+    },
43 49
 );
44 50
 
45 51
 # Start the application
20  root/src/books/list.tt2
... ...
@@ -0,0 +1,20 @@
  1
+[% # This is a TT comment.  The '-' at the end "chomps" the newline.  You won't -%]
  2
+[% # see this "chomping" in your browser because HTML ignores blank lines, but  -%]
  3
+[% # it WILL eliminate a blank line if you view the HTML source.  It's purely   -%]
  4
+[%- # optional, but both the beginning and the ending TT tags support chomping. -%]
  5
+
  6
+[% # Provide a title -%]
  7
+[% META title = 'Book List' -%]
  8
+
  9
+<table>
  10
+<tr><th>Title</th><th>Rating</th><th>Author(s)</th></tr>
  11
+[% # Display each book in a table row %]
  12
+[% FOREACH book IN books -%]
  13
+  <tr>
  14
+    <td>[% book.title %]</td>
  15
+    <td>[% book.rating %]</td>
  16
+    <td></td>
  17
+  </tr>
  18
+[% END -%]
  19
+</table>
  20
+

0 notes on commit 268cac8

Please sign in to comment.
Something went wrong with that request. Please try again.