I'm trying to match the current url a user is on to a route, and output an 'active' class if the route matches:
<?php if($this->url() == $this->url('dashboard')) echo "class='active'" ?>
This works on routes that exist. However, this will mess up 404 routing; if I go to a route that doesn't exist, i.e. localhost/someurl, I get:
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'No RouteMatch instance provided'
What is the best way to go about this?