简体   繁体   中英

CakePHP wrong views path or convections for RoutingAliases

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM