Route is useless.
Model filename should be post.php
On Oct 21, 6:09 pm, Vincent <[email protected]> wrote:
> Ok.
>
> I configured a MySQL DB and created a table 'post'.
>
> Added in app/routes.php:
> Router::connect('/posts/', array('controller' => 'posts'));
>
> Created app/controllers/posts_controller.php
> <?php
> class PostsController extends AppController {
> // var $name = 'Posts';
>
> function index() {
> $this->set('posts', $this->Post->find('all'););
> }
> ?>
>
> Created app/models/posts.php
> <?php
> class Post extends AppModel {
> var $name = 'Post';}
>
> ?>
>
> Created app/views/posts/index.ctp
> <h1>Blog posts</h1>
> <table>
> <tr>
> <th>Id</th>
> <th>Title</th>
> <th>Created</th>
> </tr>
> <?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>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---