简体   繁体   中英

Invalid controller class error in Zend Application Module Structure

I use Zend framework.I want to do Zend Application Module Structure

When I open "http://localhost/aileTerapisi_z/public" I see Zend framework home page but
When I open "http://localhost/aileTerapisi_z/public/yonetim", it give me thiss eror:

Message: Invalid controller class ("Yonetim_IndexController")

[h=3]Request Parameters:[/h]
array ( 'module' => 'yonetim', 'controller' => 'index', 'action' => 'index', ) 

how do I resolve this error

My structure is this:

application
configs
application.ini
modules
yonetim
controllers
IndexController.php
models
views
helpers
scripts
index
index.phtml

default
controllers
IndexController.php
models
views
helpers
scripts
index
index.phtml

Bootstrap.php

library
public
.htaccess
index.php


My application/configs/application.ini file is like this:

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/default/controllers"
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/yonetim/controllers"
resources.frontController.params.displayExceptions = 1

autoloadernamespaces.0 = "App_"
autoloadernamespaces.1 = "Zend_"
autoloadernamespaces.2 = "ZendX_"

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleControllerDirector yName = "controllers"

resources.frontController.env = APPLICATION_ENV
resources.frontController.throwerrors = false


resources.db.adapter = PDO_Mysql
resources.db.params.host =
resources.db.params.username =
resources.db.params.password =
resources.db.params.dbname =


;layoutpath
resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/modules/default/views/layouts"
resources.layout.layoutPath = APPLICATION_PATH "/modules/yonetim/views/layouts"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.frontcontroller.throwerrors = true 

Zend has pretty good Error Control. From the look of the error your Controller *Yonetim_IndexController.php* does exist, however inside the php-file a class with the expected name similar to:

class .*YonetimController extends Zend_Controller_Action {
}

seems to be missing - where .* may be any letters. That may happen sometime if you are copy-any-paste templating other Controllers, and forget to change the classname.

This is simple application.ini for using module structure.

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.layout.layout = default

resources.modules[] = ""
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

You can use this configuration in following file structure.

application
    configs
    controllers
       IndexController.php
    layout
       scripts
           defalut.phtml
           yonetim.phtml
    models
    modules
         yonetim
               controoler
                    IndexController.php
               models
               views
                    helpers
                    scripts
                          index
                               index.phtml       

    views
          helpers
              scripts
                  index
                     index.phtml  

public
library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM