I have a basic layout.phtml script that I use on every page. Now I would like to add an active class to the page loaded. So I would like to do like this:
class=" if route ends with = ''? active : not-active "
How can I do this in a ZF view?
I need this because I have a page with 4 links to the same action but different parameters and I want to see wich one is selected..
In your controller hit:
$this->view->assign('myParam', $this->getRequest()->getParam('yourParam', ''));
In the view put:
<?php echo ($this->myParam != '') ? 'active' : 'non-active'; ?>