I've got my routes configured as below:
routes.rooms.type = "Zend_Controller_Router_Route_Static"
routes.rooms.route = "/rooms"
routes.rooms.defaults.module = "rooms"
routes.rooms.defaults.controller = "index"
routes.rooms.defaults.action = "index"
routes.rooms.chains.room.type = "Zend_Controller_Router_Route_Regex"
routes.rooms.chains.room.route = "/(\d+)"
routes.rooms.chains.room.defaults.action = "room"
routes.rooms.chains.room.map.1 = "room_id"
routes.rooms.chains.room.reverse = "/%d"
;admin
routes.rooms.chains.admin.type = "Zend_Controller_Router_Route_Static"
routes.rooms.chains.admin.route = "/admin"
routes.rooms.chains.admin.defaults.controller = "admin"
routes.rooms.chains.admin.defaults.action = "index"
routes.rooms.chains.admin.chains.deletedrooms.type = "Zend_Controller_Router_Route_Regex"
routes.rooms.chains.admin.chains.deletedrooms.route = "/deletedRooms(?:/(\d+))?"
routes.rooms.chains.admin.chains.deletedrooms.defaults.action = "deletedrooms"
routes.rooms.chains.admin.chains.deletedrooms.map.1 = "page_id"
routes.rooms.chains.admin.chains.deletedrooms.defaults.1 = 1
routes.rooms.chains.admin.chains.deletedrooms.reverse = "/deletedRooms/%d"
All seems fine with the routes but when trying to construct a navigation menu using a route (current trying to use rooms-admin) the page shows nothing (blank white page, no error). If I remove the routes, then an error message stating the routes haven't been defined; makes sense.
If I comment out rooms-admin, a later route 'rooms-admin-deletedrooms' works fine.. so it seems rooms-admin is the problem.
I've seen this: How do I write Routing Chains for a Subdomain in Zend Framework in a routing INI file? but I don't want to use the hostname part, I want my routes to be relative to the default routing system (making changes would take too long). Any ideas what could cause this error, are the routes defined correctly?
On a side note, what is quicker to parse: ini or xml? I'm guessing a php array is the quickest method out of all the options.
Not sure about the chaining problem you are having, but I do have a suggestion for the question about parsing your config. Cache the generated config in APC, since it is just an array.
<?php
...
/** Zend_Application */
require_once 'Zend/Application.php';
// Use default application.ini config the first time
// then pull the php array from apc
$config_file = APPLICATION_PATH . '/configs/application.ini';
$config_cached = false;
if (apc_exists('application.ini')) {
$config_file = apc_fetch('application.ini');
$config_cached = true;
}
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
$config_file
);
// cache the application.ini config if this is staging or production
if (!$config_cached && ('development' != APPLICATION_ENV)) {
apc_add('application.ini', $application->getOptions());
}
reference: http://www.hellotecho.com/cache-your-zend-framework-config-to-improve-performance
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.