Question

I have all my zend applications like this

/app/
/app/registration
/app/games

I need to create a URL for games like this

mydomain.com/games/game-1

How do I set up the controllers and views in this directory structure when its like a module or sub application?

/app/games
/app/games/configs
/app/games/controllers
/app/games/controllers/Game1Controller.php
/app/games/views
...
Was it helpful?

Solution

One way would be to use the existing module conventions:

application/
  controllers/
  views/
  configs/
  modules/
    registration/
      controllers/
      views/
      configs/

The good thing about this is that ZF is already set up to handle this to some extent by convention... If you do it another way you are going to have to modify things more.

In this layout the top level controllers, views, etc.. are the Default module, while all other modules are under the modules directory.

I would also make each game its own module. If you have common code used in all games make classes you can extend and put those in your library.

OTHER TIPS

You can also use zf tool zf.sh create module yourModuleName to create the default directory structure for modules.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top