Ive got a url: http://dev.local/foodies/view?id=bluedaniel
and ive got in my bootstrap:
protected function _initRoute() {
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config, 'resources');
}
and
ive also got in my routes.ini:
[production]
resources.router.routes.foodies_view.route = ":foodies/:id"
resources.router.routes.foodies_view.defaults.module = "foodies"
resources.router.routes.foodies_view.defaults.controller = "view"
resources.router.routes.foodies_view.defaults.action = "index"
so http://dev.local/foodies/bluedaniel should work right?
I get a Resource ‘foodies:bluedaniel’ not found error however with this setup
————— UPDATE —————-
Instead of the above I added the following to the application.ini file:
resources.router.routes.myroute.route = "foodies/:id"
resources.router.routes.myroute.defaults.module = "foodies"
resources.router.routes.myroute.defaults.controller = "view"
resources.router.routes.myroute.defaults.action = "index"
resources.router.routes.myroute.defaults.id = "\w+"
This method now works although I would still prefer the routes in their seperate ini file if I can help it.
If anyone is interested, I have solved the problem, now in my bootstrap:
The problem was that in my navigation.xml I needed to add
<route>default</route>to every node. Zend documentation can be very very poor indeed at times.I also needed to declare a default variable for id otherwise it wouldnt recognise it being passed.