phpzend-frameworkmodel-view-controllerzend-controller

Integrating Zend Controller Standalone - without the rest of Zend Framework


I am using specific parts of the Zend Framework in my application, and I would like to replace my home grown controller with a Zend Framework controller.

My home grown controller is based on an index.php file to which all requests are submitted. A controller is instantiated based on parameters sent within the request

After processing the user is forwarded to url which is based on the request information, either a url is specified or some data is analysed

I would like ideas on how to integrate the Zend Controller within my application

Thanks in advance

Update: I am willing to import the rest of the dependencies, infact I already have Config, Exception, Registry, URI and View. However, I do not want to change my layout to the Zend Application layout. It seems that I may need to use the FrontController but I cannot seem to find any examples


Solution

  • By default, if you generate a default Zend Framework project, it won't have any layout. If it does, just comment or remove resources.layout.* in your config.ini or in the Bootstrap.php

    Zend_Layout is part of the Composite View Pattern which basically means it acts as a wrapper for the other views.

    You should be fine by running a default Zend Framework application and remove the layout to only use the view.

    Note, that you can still use a layout with only <?= $this->layout()->content; ?>