Bonjour, je réalise une application avec ZF 1.9.4 !
j'avais commencé à la réaliser sans faire de module. Mais maintenant je me rend compte que j'aurais bien besoin d'un module gestion (admin)
j'aurais donc besoin d'un coup de main pour pouvoir mettre mon application en appli modulaire sans faire trop de bétises!! Merci
voici mon arborescence
WebApp
-------application
-------------configs
-------------controllers
-------------forms
-------------layouts
-------------models
-------------view
-------------bootstrap.php
-------data
-------library
--------------Zend
-------public
--------------css
--------------images
--------------index.php
--------------.htaccess
Mon fichier index.php
mon fichier Bootstrap
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 <?php // Set the initial include_path. You may need to change this to ensure that // Zend Framework is in the include_path; additionally, for performance // reasons, it's best to move this to your web server configuration or php.ini // for production. set_include_path(implode(PATH_SEPARATOR, array( realpath(dirname(__FILE__) . '/../library'), get_include_path(), ))); // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap(); $application->run();
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 <?php /** * Application bootstrap * * @uses Zend_Application_Bootstrap_Bootstrap * @package QuickStart */ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { /** * Bootstrap autoloader for application resources * * @return Zend_Application_Module_Autoloader */ protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Default', 'basePath' => dirname(__FILE__), )); return $autoloader; } protected function _initConfig() { $config = new Zend_Config($this->getOptions()); Zend_Registry::set('config', $config); return $config; } /** * Bootstrap the view doctype * * @return void */ protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } }
Mon fichier application.ini
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 [production] ; PHP settings we want to initialize phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 ; Make sure the following is on the include_path includePaths.library = APPLICATION_PATH "/../library" ; Indicate the path and classname of the bootstrap bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" ; Bootstrap resources: ; - Front Controller ; - Layout ; - Database resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view[] = resources.db.adapter = "PDO_MYSQL" resources.db.params.host = "localhost" resources.db.params.username = "root" resources.db.params.password = "" resources.db.params.dbname = "zend_test" resources.db.isDefaultTableAdapter = true [staging : production] ; Were you to have a 'staging' environment, you could customize application ; settings here [testing : production] ; For testing, we want to display errors and use a different database phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.db.params.dbname = "zend_test" [development : production] ; For development, we want to display errors and use a different database phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.db.params.dbname = "zend_test"
Partager