A
A
Andrey2014-08-14 17:12:28
Zend Framework
Andrey, 2014-08-14 17:12:28

Zend Framework 2. Is it possible to make two different actions have the same route?

Good afternoon.
There is such a hypothetical problem. The site has simple pages and category pages. Both can have the url site.ru/category_or_page_name
Is it possible to attach one route to two different actions and then:
1. look in the page action, if there is no page, exit the action; if there is, execute it and display the page.
2. in the category action, look, if there is no category, exit the action; if there is, execute it and display the contents of the category.
3. if nothing is found on this route, display an error that the page does not exist.
Is this even possible?
Some clients resist with a horn and give them similar functionality, and they do not want such urls site.ru/page/page_name orsite.ru/catalog/category_name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-08-14
Protko @Fesor

one round, one action. You can try to implement something like a middleware that will resolve everything, you can write logic that will transform the request and thus you will always have 2 rounds and two actions ... there are a lot of options.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question