i'm running into a routing beginners problem with zend framework 2: i want to make a routing that will work something like this:
www.mysite.com/city/school/class
with the routing i want to be able:
www.mysite.com/chicago
will take me to a city.phtml page with "chicago" as a parameter
same with
www.mysite.com/chicago/jcc
will take me to a school.phtml with "jcc" as a parameter name
and so on..
what i tried to do is:
return array(
'router' => array(
'routes' => array(
'main' => array(
'type' => 'segment',
'options' => array(
'route' => '[/:city][/:school][/:class]',
'constraints' => array(
'city' => '[a-zA-Z][a-zA-Z0-9_-]*',
'school' => '[a-zA-Z][a-zA-Z0-9_-]*',
'class' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
...
but i don't have any idea how to continue from here :(
thanks!
after a couple of hours i got it working, hope this helps someone:
so when calling
i am redirected to the city action and can get the chicago var in my controller by: