07.05 php saved
Kinicky
Tags add more
 
Note
Kinicky did not leave a note
  1. <--!app\models\post.php-->
  2. <?php
  3. class Post extends AppModel
  4. {
  5. var $name = 'Post';
  6. }
  7. ?>
  8.  
  9.  
  10.  
  11. <--!app\controllers\posts_controller.php-->
  12. <?php
  13. class PostsController extends AppController
  14. {
  15. var $name = 'Posts';
  16. function index()
  17.  {
  18. $this->set('posts', $this->Post->findAll());
  19. }
  20. }
  21. ?>
  22.  
  23.  
  24. <--!/app/views/posts/index.thtml-->
  25. <h1>Blog posts</h1>
  26. <table>
  27.     <tr>
  28.         <th>Id</th>
  29.         <th>Title</th>
  30.         <th>Created</th>
  31.     </tr>
  32.  
  33.  
  34.     <?php foreach ($posts as $post): ?>
  35.     <tr>
  36.         <td><?php echo $post['Post']['id']; ?></td>
  37.         <td>
  38.             <?php echo $html->link($post['Post']['title'], "/posts/view/".$post['Post']['id']); ?>
  39.         </td>
  40.         <td><?php echo $post['Post']['created']; ?></td>
  41.     </tr>
  42.     <?php endforeach; ?>
  43.  
  44. </table>
  45.  
  46.  
  47.  
Parsed in 0.046 seconds, using GeSHi 1.0.7.14

Modify this Paste