Configs project ZendFramework

1.Create the tree directory looks like the following:


|-- 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


2.The Bootstrap
Your Bootstrap class defines what resources and components to initialize with file \application\Bootstrap.php.



3.Configuration 
The default configuration is placed in application/configs/application.ini, and contains some basic directives for setting your PHP environment, indicating the path to your bootstrap class, and the path to your action controllers.



4.Index.php
File start project in \public\index.php.



5.Action Controllers
Your application's action controllers contain your application workflow, and do the work of mapping your requests to the appropriate models and views.
The default IndexController is as follows:


6.Views
View scripts are placed in application/views/scripts/, where they are further categorized using the controller names. In the default case, we thus have the view scripts index/index.phtml
The following is what we install by default for the index/index.phtml view script:


7.Output

Zend_Controller

Zend_Controller is the heart of Zend Framework's MVC system. MVC stands for » Model-View-Controller and is a design pattern targeted at separating application logic from display logic.Zend_Controller_Front implements a » Front Controller pattern, in which all requests are intercepted by the front controller and dispatched to individual Action Controllers based on the URLrequested.
Create the Filesystem Layout
application/
    controllers/
        IndexController.php
    models/
    views/
        scripts/
            index/
                index.phtml
        helpers/
        filters/
html/
    .htaccess
    index.php
config/
     config.ini


*application: will the programming code of the application
- Controllers: source file contains the application processing

- Models: the files related to database handling

- View / scripts /: contains the directory. name of this folder will correspond to the Controller in the directory controllers. In each folder containing the. Phtml. Pages. Phtml is responsible for data output to the external interface

- Helpers: contains the file. Php. These files are simply expanding handler of the application, for example: handler involved that day in May in the library without ZF

- Filters: contains the file. Php. These files can also act as helpers in the directory file. But I often used to store the file has the function check condition of entry form.

*Html file containing the ZF startup (bootstrap), plus it can be a container imges, css, js ...
*Config file containing the application's configuration file



Multi layouts for Zend Framework


1. Create a directory \ templates as shown below:
2. Create index.phtml file in the folder \application\templates\admin with the following contents:


 3. Create index.phtml file in the folder \application\templates\default
with the following contents:

 4. Load layout in Admin modules: - Create function init () in
\application\modules\admin\controllers\IndexController.php
with the following contents:

 5. Load layout in Default modules. - Create function init () in
application\modules\default\controllers\IndexController.php
with the following contents:

19 steps to setting and configure the Zend Framework.



  • Step 1: Build system directories and files for the application 
  • Step 2: Declare the physical path to the application 
  • Step 3: Declare the application configuration in the configuration file 
  • Step 4: Declare the path to the folder containing the Zend Framework library 
  • Step 5: Go into the application layer Zend_Application 
  • Step 6: Create the class Bootstrap 
  • Step 7: Set the system error to the application 
  • Step 8: Declare path of initialization file (Bootstap.php) 
  • Step 9: Declare class Bootstrap 
  • Step 10: Declare the folder containing the application's Controller (appliction.ini) 
  • Step 11: Declare interface file name (layout.phtml) 
  • Step 12: Declare the path to the directory containing the main (layout) 
  • Step 13: Creating Zend_Application object and read the configuration file 
  • Step 14: Start the application 
  • Step 15: Create the file layout 
  • Step 16: Create IndexController 
  • Step 17: Create files for IndexController View 
  • Step 18: Build files. Htaccess 
  • Step 19: Run the application