Routing in Zend'e?

Good time of day.

Prompt, knowledgeable people, is it possible (and if so, how?) to organize Zend'e routing like this:
http://example.com/blogs/ - displays a list of blog topics

http://example.com/blogs/id08 - displays a list of blogs relevant section

http://example.com/blogs/post08 - displays written blog



Googled a couple of hours, adequate and explanatory information was not found. With Zend'om work recently, therefore, stalled.

Thanks for any help :)
October 3rd 19 at 03:25
3 answers
October 3rd 19 at 03:27
Solution
Not seen zend, but here is the Google:
$route1 = new Zend_Controller_Router_Route_Regex(
’blogs/id(.*)’,array(
 ‘action’ => 'ololo',
 ’controller’ => 'lololo',
 ‘module’ => 'default'),
 array(1 => 'id'));
$route2 = new Zend_Controller_Router_Route_Regex(
’blogs/post(.*)’,array(
 ‘action’ => 'lolo',
 ’controller’ => 'olol',
 ‘module’ => 'default'),
 array(1 => 'id'));
$route3 = new Zend_Controller_Router_Route_Regex(
’blogs/’,array(
 ‘action’ => 'lolo',
 ’controller’ => 'olol',
 ‘module’ => 'default'),
array());

The latter is possible without regex of course, but too lazy to look for more.
And the number then get so $this->getRequest->getParam('id')
And maybe with the slashes I made a mistake in the regular season.
October 3rd 19 at 03:29
Yes, it's possible to implement this using of the regular season, but there are differences in the implementation of the routing zf1 and zf2
October 3rd 19 at 03:31

And it is possible still so: 1. Instigate the Bootstrap router in-e:


protected function _initRouter()
{
 $fc = Zend_Controller_Front::getInstance();
 $router = $fc->getRouter();
 $routerConfig = new Zend_Config_Ini('/../applications/configs/routes.ini');
 $router->addConfig($routerConfig, 'routes'); 
}
2. In routes.ini prescribe dynamic router:

routes.blog.type = "Zend_Controller_Router_Route"
routes.buy.route = "blog/:id"
routes.blog.defaults.module = "default"
routes.blog.defaults.controller = "blog"
routes.blog.defaults.action = "index"
3. Taken in the appropriate controller, 'id': $this->getRequest->getParam('id')

Find more questions by tags PHPZend Framework