Vulnero

Seamless WordPress and Zend Framework Integration

All page requests not handled by Vulnero's routing are passed on to WordPress; therefore, you must explicitly add routes to the application/config/routes.ini configuration file. This is a standard Zend_Config_Ini file that accepts any valid Zend_Router_Route_* component.

WordPress Routes

Unless overridden, routes handled by your application are rendered in your WordPress theme's default page template. This allows your widgets, menus, headers, footers and styling all to carry over to your application and eliminates any need to write your own layout or HTML for purposes of styling. To add a new route for your application, add it to application/config/routes.ini:

myapp.type = Zend_Controller_Router_Route
myapp.route = myapp/:controller/:action
myapp.defaults.module = default
myapp.defaults.controller = index
myapp.defaults.action = index
If a controller or action is requested and not present, the request will fallback to WordPress' 404 page. To handle this type of exception yourself, add a public function __call($action) {} method to your controller.

The above route would allow you to sandbox requests to your application via the /myapp prefix. We set defaults for the module, controller and action to specify values if they're left empty.

Standalone Routes

Your routes can be standalone, meaning WordPress will not be invoked and your application will entirely handle the request. This is helpful if your application has vastly different display logic that can't be conveyed by your WordPress template or for routes displaying context-specific content like JSON or XML output.

To add a standalone route, add it to application/config/routes.ini with the special wordpress attribute:

myapp.type = Zend_Controller_Router_Route
myapp.wordpress = false
myapp.route = myapp/:controller/:action
myapp.defaults.module = default
myapp.defaults.controller = index
myapp.defaults.action = index

Default Routes

By default, Zend's default routing is disabled so that WordPress can handle all unspecified routes. Two routes (helloworld and hellostatic) are included by default to serve as examples. You will probably want to remove these default routes once you start adding your own custom routes.