0
votes

I've read a book titled zend framework: beginner's guide. It was mentioned that it's best practice to create modules and categorize things.

I've added the modules directory to the application directory and moved views,controllers and models directory into it. The structure is as below:

application

  • configs
  • modules
  • Bootstrap.php

when I pop open the browser and surf to the following URLs:

localhost/square/default/index/index

OR

localhost/square/public/default/index/index

I get not found error message. I've changed the configuration file (application.ini) as below:

resources.frontcontroller.controllerDirectory = APPLICATION_PATH "/modules/default/controllers"
resources.frontcontroller.params.displayExceptions = 0
resources.frontcontroller.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""

I've read the following questions, but that didn't help:

Change Zend Framework Default Module

Zend Framework not include the default module in url

2

2 Answers

1
votes

Just use this instead :

resources.frontcontroller.controllerDirectory = APPLICATION_PATH "/controllers"

EDIT :

I noticed that you use localhost/square/ to access your pages. You have to setup a virtual host to fix your problem since the router need it to work properly.

See : http://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html#learning.quickstart.create-project.vhost

1
votes

this should work.

resources.modules[] = ""    
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleControllerDirectoryName = "controllers"
resources.frontController.defaultModule = "default"
resources.frontController.defaultControllerName = "index"
resources.frontController.defaultAction = "index"
resources.frontController.env = APPLICATION_ENV