0
votes

I'm very confused. I'm using CakePHP 1.2 and try to add this structure:

  • DB name: routingaliases
  • Model name: Routingalias, routingalias.php
  • Controller: RoutingaliasesController and var $name = 'Routingaliases';, routingaliases_controller.php
  • Views: folder name - routingaliases and there are index.ctp and main.ctp

But when try to open http://example.com/routingaliases/index I received error:

Error: The view for RoutingaliasesController::index() was not found.

Error: Confirm you have created the file: /var/www/***/views/routingaliases/index.ctp

Notice: If you want to customize this error message, create */views/errors/missing_view.ctp

Actually folder and view file exist, but I got it error. Can someone help me how to fix it?

2
Are you sure the file is readable by your web server? Make sure the view file has the proper permissions (on Linux servers usually www-data or apache user as owner, with chmod 644 permissions). Also try checking your error log for further details (might be worth checking both your web server's error log as well as cake's logs under app/tmp/logs/error.log and debug.log).Oldskool
Thank you, @Oldskool This resolved my problem. The problem was: someone created that folder with root permissions and then a had a lot of problems...Dodo
Good to hear, posted this as an answer, since it might help other people with the same problem find the solution more easily.Oldskool

2 Answers

1
votes

Are you sure the file is readable by your web server? Make sure the view file has the proper permissions (on Linux servers usually www-data or apache user as owner, with chmod 644 permissions).

Also try checking your error log for further details (might be worth checking both your web server's error log as well as cake's logs under app/tmp/logs/error.log and debug.log).

0
votes

Sounds like a problem with your naming, not sure what it is, but why don't you use the CakePHP naming convention? According to it, you should have:

views folder: routing_aliases

model: routing_alias.php, class name RoutingAlias

controller: routing_aliases_controller.php, class name RoutingAliasesController, var $name = RoutingAliases

The db table name would be routing_aliases, but if for some reason you don't want to change it you can add in the model var $useTable = 'routingaliases';