It returns apache not found error.

So my web root dir is /var/www

then in it i bake a "blog" so i have /var/www/blog directory
now..where is the root dir for my cake php project.

Then i bake Controller / Model / View

Here are the codes :

Model:  (Noting added)

[code]

<?php
class Post extends AppModel {

        var $name = 'Post';

}
?>

[/code]

Controller:
Here i add this $this->set('posts', $this->Post->find('all'));
[code]

<?php
class PostsController extends AppController {

        var $name = 'Posts';
        var $helpers = array('Html', 'Form', '');

        function index() {
                $this->set('posts', $this->Post->find('all'));
<-------------------
                $this->Post->recursive = 0;
                $this->set('posts', $this->paginate());
        }

        function view($id = null) {
                if (!$id) {
                        $this->flash(__('Invalid Post', true),
array('action' => 'index'));
                }
                $this->set('post', $this->Post->read(null, $id));
        }

        function add() {
                if (!empty($this->data)) {
                        $this->Post->create();
                        if ($this->Post->save($this->data)) {
                                $this->flash(__('Post saved.', true),
array('action' => 'index'));
                        } else {
                        }
                }
        }

        function edit($id = null) {
                if (!$id && empty($this->data)) {
                        $this->flash(__('Invalid Post', true),
array('action' => 'index'));
                }
                if (!empty($this->data)) {
                        if ($this->Post->save($this->data)) {
                                $this->flash(__('The Post has been
saved.', true), array('action' => 'index'));
                        } else {
                        }
                }
                if (empty($this->data)) {
                        $this->data = $this->Post->read(null, $id);
                }
        }
function delete($id = null) {
                if (!$id) {
                        $this->flash(__('Invalid Post', true),
array('action' => 'index'));
                }
                if ($this->Post->del($id)) {
                        $this->flash(__('Post deleted', true),
array('action' => 'index'));
                }
                $this->flash(__('The Post could not be deleted.
Please, try again.', true), array('action' => 'index'));
        }

}
?>
[/code]

View:

[code]

<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>

[/code]

So when i m going to http://mydomain.com/blog/posts

returns to me an 404 not found error..

Thats all .
Hope make it more clearly..now..

Thanks again my friend for your answers..!

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to