2009年5月26日星期二

Re: [fw-mvc] ZF 1.8.1 MVC configuration

Emanuel-20 wrote:
>
> Greetings,
>
> Has anyone a simple working example using 2 modules in ZF 1.8.1 ?
> I'm stuck not knowing what I need to set to make it work.
>
> My application folder looks like this:
>
> application
> | Bootstrap.php
> |
> +---configs
> | application.ini
> |
> \---modules
> +---admin
> | +---controllers
> | | IndexController.php
> | |
> | +---models
> | \---views
> | +---filters
> | +---helpers
> | \---scripts
> | \---index
> | index.phtml
> |
> \---default
> +---controllers
> | ErrorController.php
> | IndexController.php
> |
> +---models
> \---views
> +---filters
> +---helpers
> \---scripts
> +---error
> | error.phtml
> |
> \---index
> index.phtml
>
> The content of application.ini is:
>
> [production]
> phpSettings.display_startup_errors = 0
> phpSettings.display_errors = 0
> includePaths.library = APPLICATION_PATH "/../library"
> bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
> bootstrap.class = "Bootstrap"
> resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
> resources.frontController.defaultModule = "default"
> ;resources.frontController.controllerDirectory = APPLICATION_PATH
> "/controllers"
>
> [staging : production]
>
> [testing : production]
> phpSettings.display_startup_errors = 1
> phpSettings.display_errors = 1
>
> [development : production]
> phpSettings.display_startup_errors = 1
> phpSettings.display_errors = 1
>
> and the rest of the files contents are the same as generated by Zend
> Tool command line.
>
> I changed the folder structure a bit, hopping that it may work, but
> seems that I cannot access any other module except the default one.
>
> When I try to access:
> http://localhost/dragos/public/admin
>
> I get the following error:
>
> An error occurred
> Page not found
> Exception information:
>
> Message: Invalid controller class ("Admin_IndexController")
> Stack trace:
>
> #0
> C:\xampp\htdocs\dragos\library\Zend\Controller\Dispatcher\Standard.php(255):
> Zend_Controller_Dispatcher_Standard->loadClass('IndexController')
> #1 C:\xampp\htdocs\dragos\library\Zend\Controller\Front.php(936):
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http))
> #2
> C:\xampp\htdocs\dragos\library\Zend\Application\Bootstrap\Bootstrap.php(77):
> Zend_Controller_Front->dispatch()
> #3 C:\xampp\htdocs\dragos\library\Zend\Application.php(328):
> Zend_Application_Bootstrap_Bootstrap->run()
> #4 C:\xampp\htdocs\dragos\public\index.php(26): Zend_Application->run()
> #5 {main}
>
>
> Request Parameters:
>
> array(3) {
> ["module"]=>
> string(5) "admin"
> ["controller"]=>
> string(5) "index"
> ["action"]=>
> string(5) "index"
> }
>
>


I think you should and must give a namespace to IndexController for module
admin :

class Admin_IndexController extends Zend_Controller_Action
{
......
}

-----
kim ho from china

http://kimbs.info/ http://kimbs.info

http://zend.com/zce.php?c=ZEND005888&r=229591104 Zend Certificated Engineer

Zend Framework Certificated Engineer
--
View this message in context: http://www.nabble.com/ZF-1.8.1-MVC-configuration-tp23724306p23735118.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: