Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added the view http://book.cakephp.org/view/336/creating-post-views

  • Loading branch information...
commit f0ff3d9fe7106480fa9687e8121b9ac17feed53e 1 parent f398d05
@mariuz authored
Showing with 21 additions and 3 deletions.
  1. +21 −3 app/views/posts/index.ctp
View
24 app/views/posts/index.ctp
@@ -1,5 +1,23 @@
-<?php
+<h1>Blog posts</h1>
+<table>
+ <tr>
+ <th>Id</th>
+ <th>Title</th>
+ <th>Created</th>
+ </tr>
-print_r($posts);
+ <!-- Here is where we loop through our $posts array, printing out post info -->
+
+ <?php foreach ($posts as $post): ?>
+ <tr>
+ <td><?php echo $post['Post']['id']; ?></td>
+ <td>
+ <?php echo $html->link($post['Post']['title'],
+"/posts/view/".$post['Post']['id']); ?>
+ </td>
+ <td><?php echo $post['Post']['created']; ?></td>
+ </tr>
+ <?php endforeach; ?>
+
+</table>
-?>
Please sign in to comment.
Something went wrong with that request. Please try again.