Friday, April 2, 2010

Problems with tutorial from The Cookbook

Hi to all,

Today I just recently installed the framework and I began to
experiment with the tutorials/examples provided. I was doing this one
http://book.cakephp.org/view/219/Blog and I think I followed all of
the instructions correctly but when I try to access (http://localhost/
bases/index
) to see the result, I see the following error:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Missing Controller
Error: IndexController could not be found.

Error: Create the class IndexController below in file: app\controllers
\index_controller.php

<?php
class IndexController extends AppController {

var $name = 'Index';
}
?>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Here is my code from post.php, saved in C:\Program Files\xampp\htdocs
\bases\app\models:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/
<?php

class Post extends AppModel {
var $name = 'Post';
}
?>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Here is my code from posts_controller.php, saved in C:\Program Files
\xampp\htdocs\bases\app\controllers:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<?php
class PostsController extends AppController {

var $name = 'Posts';

function index() {
$this->set('posts', $this->Post->find('all'));
}

function view($id = null) {
$this->Post->id = $id;
$this->set('post', $this->Post->read());
}
}
?>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Here is my code from index.ctp, saved in CC:\Program Files\xampp\htdocs
\bases\app\views\posts:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<h1>Blog posts</h1>
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Created</th>
</tr>

<!-- Aqui se hace el ciclo que recorre nuestros arreglo $posts ,
imprimiendo la información de cada post-->

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

Thanks for the help in advance...
PS: I hope my English is readable


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

To unsubscribe, reply using "remove me" as the subject.

No comments: