How to get action name and value of id in template view (index.html). Need to insert action name in <h1> ... </h1>
and use id value to select current option in menu.
My route:
'route' => '/:action[/:id]',
'constraints' => array(
'id' => '[0-9]+',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
Content of the index.html:
<h1>... </h1>
<div class="menu">
<a href="#"> option where ID = 1 </a>
<a href="#"> option where ID = 2 </a>
<a href="#"> option where ID = 3 </a>
</a>
You can do it by making a view helper as dominic watson has answered in this question Dominic Watson Answer for creating view helper to get controller name in view OR
more easy answer would be available at