Creating a Zend Controller File

This procedure describes how to create a new Zend Controller file. A Zend Controller is a class for working with the "controller" portion of the model-view-controller pattern. The Zend Controller manages the communication between user actions and your application.

See https://framework.zend.com/ for more information on the Zend Controller.

 

Zend Studio offers the option to create Zend Controller files based on the Zend Controller Template (for projects based on Zend Framework version 1.7 and below) and based on the Zend Tool (for projects based on Zend Framework version 1.8 and above).

 

 

Instructions on how to complete a procedure

To create a new Zend Controller file:

  1. In PHP Explorer view, right-click the controllers folder in your Zend Framework Project and select New | Zend Framework Item | Zend Controller.
    The New Zend Controller Wizard is displayed.

  1. If you selected to create a Zend Tool based Controller:

    1. Enter a name for the Controller.
      The default name for the created controller will be <Controller Name>Controller.php (e.g. MyNewController)
      The default location for the file will be in the application's default 'controllers' folder.
    2. Select the required containing Zend Framework project from the Project Name drop-down list.
  2. If you selected to create a Template-based Controller:
    1. Ensure the required containing source folder is correct.
      It is recommended to create all Zend Controllers in the project's controllers folder.
    2. Enter the Controller name in the File Name field.
    3. Click Next.
      The Select PHP Template dialog is displayed.

    1. Select the required template upon which the controller is to be based.
  3. Click Finish.

A new Zend Controller file will be created with the relevant template.

The new file will be created in the project's 'controllers' folders and displayed in the MVC Outline view.