views:

32

answers:

1

Hi, I've installed Zend Studio 7.1.1 that contains 1.9 framework. For the server side, I use easyphp (very similar to wamp)

When I create the project, I obviously obtain this architecture:

MyProject
|-- application
|   |-- Bootstrap.php
|   |-- configs
|   |   `-- application.ini
|   |-- controllers
|   |   |-- ErrorController.php
|   |   `-- IndexController.php
|   |-- models
|   `-- views
|       |-- helpers
|       `-- scripts
|           |-- error
|           |   `-- error.phtml
|           `-- index
|               `-- index.phtml
|-- library
|-- public
|   |-- .htaccess
|   `-- index.php
`-- tests
    |-- application
    |   `-- bootstrap.php
    |-- library
    |   `-- bootstrap.php
    `-- phpunit.xml

To launch the project, I enter:

http://127.0.0.1/MonProjet/public/index.php

But when I create a new controller (TestController.php) and the associated view (application.views/test/index.phtml) and when I enter:

http://127.0.0.1/MonProjet/public/test

the browser returns the error : object not found (404).

although I activated the mod_rewrite

LoadModule rewrite_module modules/mod_rewrite.so

So, how can I set the routing mechanism to reach the new controllers and their views?

Thank you very much, regards.

A: 

Your index.php file has the Autoloader class call which loads all the controller and models automatically.

Along with that you can also add this code in your BootStrap.php file.

protected function _initAutoload()
{
    $modeLoader = new Zend_Application_Module_Autoloader(array
        ('namespace'=>'Application','basePath'=>APPLICATION_PATH ));

return $modeLoader;
}
Sumit Ghosh
Thanks for your answer. But it doesn't work even if I added:require_once 'Zend/Loader.php';Zend_Loader::registerAutoload();to load automatically the controllers and the models.Thanks again.
Zakaria