Hi all,

I'm following the basic cakephp Blog example, here is my code:

posts_controller.php
<?php
class PostsController extends AppController
{
    var $name = 'Posts';
    var $uses = array();

    function index() {

                $this->set('posts', $this->Post->find('all'));
    }
}
?>

post.php
<?php
class Post extends AppModel {
        var $name = 'Post';
}
?>

index.ctp
<h1>Blog posts</h1>
        <table>
                <tr>
                        <th>Id</th>
                        <th>Title</th>
                        <th>Created</th>
                </tr>
   <!-- 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'],
                                array('controller' => 'posts', 'action' => 
'view', $post['Post']
['id'])); ?>
                        </td>
                        <td><?php echo $post['Post']['created']; ?></td>
                </tr>
                <?php endforeach; ?>
  </table>

However i'm contantly getting this annoying error:
Fatal error: Call to a member function find() on a non-object in C:
\Program Files\xampp\htdocs\Blog\app\controllers\posts_controller.php
on line 9

Can someone please help me
thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to