Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3282824
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:58:17+00:00 2026-05-17T19:58:17+00:00

I’m looking for a step-by-step explanation on how to go from the normal folder

  • 0

I’m looking for a step-by-step explanation on how to go from the normal folder structure on the left where the application folder contains models,views,controllers, to the module-based folder structure on the right where application contains a modules folder which contains the individual modules with their own models,views,controllers.

I say “conversion” because I don’t think zend lets us create projects using the module architecture from the start, but if it did, that would be swell and would remove the need to make these folder structure changes manually.

http://img375.imageshack.us/img375/5582/foldersboth.jpg

Here’s my experience so far

  • When I create a module zf create module product, the modules folder is generated and a folder product is generated inside it and the views,controllers,models for that module are also generated.

  • But I also need to move the main views,controllers,models to a modules/default folder of their own. If I create that folder manually and move the main views,models,controllers there, I get a bug when trying to add new controllers to that default module. The bug is that it re-generates the main (now missing) views,controllers,models in application and inserts that new controller in application/controllers/newcont because it doesn’t recognize that the default controllers folder has been moved manually to application/modules/default/controllers/.

  • So my solution to that has been to zf create module default then copy the main views,models,controllers there. It ends up looking the same but somehow the zf create module method makes a difference. When I do it this way, new controllers get added correctly into application/modules/default/controllers and not application/controllers

Half the problem solved. But when I try to view the application, I don’t see anything from index/index view. I don’t get any errors either, but I see nothing. I suspect that it’s because the application doesn’t know that the index/index view has moved.

  • This used to be located at application/views/scripts/index/index.phtml
  • but is now located at application/modules/default/views/scripts/index/index.phtml

I’m guessing I need to make changes to application.ini or to bootstrap.php or some other location. So what exactly are the steps to get this thing done smoothly and get it working? I’m using the latest ZF 1.10.8. Please start from create a new zend project so there’s no confusion on the exact steps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:58:17+00:00Added an answer on May 17, 2026 at 7:58 pm

    Here’s what I did to try and follow your example (from scratch):

    $ zf create project .
    $ zf create module product
    $ zf create module default
    

    I then moved controllers, models and views from ./application to ./application/modules.

    Next I opened up application.ini, and replaced this line (which tells ZF where to find controllers in a non-modular app):

    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
    

    with:

    resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
    

    which tells ZF where to find modules.

    I then manually created an index controller for the product module so I could test that this worked, which it did. I then hit http://localhost/index/index to see if the default module index action still worked, it didn’t, instead I got the error:

    Fatal error: Uncaught exception ‘Zend_Controller_Dispatcher_Exception’ with message ‘Invalid controller class (“Default_ErrorController”)’ in …

    it sounds like this is where you got to.

    There are two ways to fix this error, and the documentation is quite misleading (possibly even wrong). It states:

    Note that in the default module, controllers do not need a namespace prefix. Thus, in the example above, the controllers in the default module do not need a prefix of ‘Default_’ — they are simply dispatched according to their base controller name: ‘IndexController’ and ‘FooController’. A namespace prefix is used in all other modules, however.

    but clearly the error above indicates that ZF is looking for an ErrorController class called Default_ErrorController. To fix this you can do one of two things:

    • Change the class names of application/modules/default/controllers/IndexController.php from IndexController to Default_IndexController, and application/modules/default/controllers/ErrorController.php from ErrorController to Default_ErrorController
    • Or remove this line:

      resources.frontController.params.prefixDefaultModule = “1”

    from application.ini. This line tells ZF to use the ‘Default_’ namespace on the default module classes, so without it it will just look for ‘IndexController’. I went for the latter option, and http://localhost/index/index then worked as expected.

    In your case you said you got a blank page at /index/index, which means either:

    • You have a different problem
    • You have errors disabled in development mode
    • You are running in production mode where errors are disabled by default (most likely)

    to check the last option, open application.ini and temporarily change phpSettings.display_errors from 0 to 1 in the production section. If you then get the same error I had above, hopefully you’ll be able to get everything working.

    I hope this is helpful. All I can say is don’t get too reliant on Zend_Tool for management of your app – it can’t do everything, and often it’s easier to manually move things around than to try and do everything via. the zf command; particularly when restructuring.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.