first, I don't need to "switch" layout.
I'm speaking of CSS theme, that means the layout remains the same.
What I need to do is switch a css class when on certains category.
Category are defined by the route (name & id in request params)
So I think of a ViewHelper, used in my layout.phtml
to set a <body class="theme-category"></body>
But I'll to access the request object in my view helper, is it possible? Is it best practice?
Secondly I though to use the same process but pass the parameters in my controller, and fallback on a default one in my helper if none provided.
What are you feedbacks?
In your layout put this
<?=$this->headLink(); ?>
And in the controllers you can add a specific css file like this
$this->view->headLink()->appendStylesheet("/css/file.css");
That will enable you to change the css theme on every controller. P.S. add it in the init function of the controller.