SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Zend Framework Modular Layout

    Hello,
    I have a problem with Zend Framework's modular layout and I can't find an explanation anywhere...
    I want my project to be modular. My file structure is as follows:

    Code:
    root
       app
          config
             config.ini
          log
          modules
             default
                config
                controllers
                   IndexController.php
                models
                views
                   scripts
                      index.phtml
                   filters
                   helpers
             mymodule
                config
                controllers
                   Mymodule_IndexController.php
                models
                views
                   scripts
                      index.phtml
                   filters
                   helpers
       public
          index.php
       bootstrap.php
    The reds are directories

    In my bootstrap file I call
    PHP Code:
    $front->addModuleDirectory('app/modules'); 
    And when I want to load for ex. www.example.com then the default module loads up, with IndexController.php and index.phtml
    This is no problem

    But when I want to load www.example.com/mymodule then it breaks. The problem is it cannot find index.

    I tried lot's of different method,but none of them are working. Can somebody help me out? I cannot find an example for this in the documentation...

  2. #2
    SitePoint Member
    Join Date
    Oct 2007
    Location
    East Sussex
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you defined your controller directory name for each of the modules? ie Controllers in your case

    Code:
    $front->setModuleControllerDirectoryName('controllers');
    Also your directory mymodule needs a captial Mymodule if your running on linux (case sensitive!)

    Finally, and im not sure this will make any difference, you could try and use an absolute path.

  3. #3
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I set up the controller's directory. And changed the mymodule folder to Mymodule
    No the error is the dispatcher cannot find the module (Mymodule)

    If I change back to lowercase then the erorr is the dispatcher cannot find (index)
    "exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index)'"

  4. #4
    SitePoint Member
    Join Date
    Oct 2007
    Location
    East Sussex
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry just noticed that in your module Mymodule your controller index file should only need to be IndexController.php BUT the class name should be Mymodule_IndexController, your path should be

    www.example.com/Mymodule

    If this doesnt work can you post your bootstrap file please

  5. #5
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It works now. thanks. I'm trying to figure out now how to add common view elements (header, footer) to my views...
    And to change phtml to php I used viewSuffix but it's not working...

    Can you send me a PM with your messenger id to have a chat, pls... I use gtalk and yahoo


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •