Reputation: 33408
I'm writing a basic plugin for my cakePHP 2.x app following the instructions in the book.
I've created the directory/file structure with a MyPluginAppController.php and MyPluginAppModel.php.
I added CakePlugin::load('MyPlugin');
to the parent app's bootstrap.php file.
Then I created one Controller and Model. But for some reason when I try to view mysite.dev/(admin)/my_plugin/my_model/
I get a "Missing View" error. It says to confirm that the view file exists, which it does!
I don't think I skipped any steps from the book. What am I doing wrong?
Update:
Controller path: app/Plugin/MyPlugin/Controller/MyModelController.php
View path: app/Plugin/MyPlugin/View/MyModel/admin_index.php
URL: http://mysite.dev/admin/my_plugin/my_model/
Upvotes: 0
Views: 1739
Reputation: 5276
I was't using a plugin so my case was a bit different. However, this question shows up on the search results page, so I'll post this here.
This is the problematic controller.
<?php
class ArticlesController extends AppController {
public function beforeFilter() {
}
public function view() {
// do stuff
}
}
CakePHP kept showing me the following error:
Missing View
Error: The view for ArticlesController::view() was not found.
Confirm you have created the file: Articles/view.ctp in one of the following paths:
I checked all paths it suggested using is_readable()
and the stat
command to make sure the view file exists and is indeed readable by PHP.
The issue there is the empty beforeFilter()
. As soon as I removed it everything worked.
Upvotes: 0
Reputation: 54821
Rename this file
app/Plugin/MyPlugin/View/MyModel/admin_index.php
To this extension .ctp
app/Plugin/MyPlugin/View/MyModel/admin_index.ctp
This is a common mistake.
Upvotes: 4