I'm new to CakePHP, so I decided to download yesterday from the
website the last stable version 1.3.7 from cakephp.org.
After struggling to set everything up in my 1&1 hosting, and realizing
that it only works when installing it in the root of my domain, not in
a subfolder (if anyone knows a link with an explanation of how to do
that, it would be very helpful though) I decided to follow the Blog
tutorial to get in touch with CakePHP. Well, I didn't get very far...
At the step "11.7.1 Create a Post controller" (http://book.cakephp.org/
view/1531/Cake-Database-Configuration#!/view/1535/Create-a-Posts-
Controller), I get the following error when uploading the file created
there:
Fatal error: Cannot redeclare class PostsController in /homepages/28/
d230065733/htdocs/cakePHP/app/controllers/posts_controller.php on
line 15
I've followed exactly what the tutorial says. I've actually started
over to see if I had missed something, being super careful, but still
the same error. This is how that file looks like:
<?php
class PostsController extends AppController {
var $helpers = array ('Html','Form');
var $name = 'Posts';
function index() {
$this->set('posts', $this->Post->find('all'));
}
}
?>
If I try the application before uploading this file, I get the obvious
error that "PostController" does not exist, and asks me to create it.
If I create it and upload the file (posts_controller.php) without the
index() function, I get an error saying that "Action index is not
defined", which is also normal. But when I include that fragment of
code, then I get the fatal error I mentioned before, with all the
display on white and the error message on black.
I've followed the tutorial line by line and I don't see any difference
between my code and the tutorial. Another weird thing is that the
fatal error says "on line 15", when the code has only 10... And by the
way, when I installed and configured the CakePHP project, I got all
the test things on green, so I don't think it's a configuration
problem...
I'm super confused and frustrated, I want to learn CakePHP but it
sucks to be struggling so early! Any help or advice would be much
appreciated! I assume that the tutorial works, so I guess that I'm
doing something wrong, but I have no clue what can it be...
Thanks so much in advance!
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
No comments:
Post a Comment