Alireza
Alireza

Reputation: 6848

Defining default module in Zend framework doesn't work

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

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

Upvotes: 0

Views: 700

Answers (2)

Fouad Fodail
Fouad Fodail

Reputation: 2643

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

Upvotes: 1

Thanh Nguyen
Thanh Nguyen

Reputation: 5342

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

Upvotes: 1

Related Questions