I am trying to render templates in Symfony with a CSS class to denote which part of the site they belong to. For example: I am in /games I’d like the page to look something like:
<div id="wrapper" class="games">
<!-- content -->
</div>
Or if we are displaying /home/profile the page would look like this:
<div id="wrapper" class="home">
<!-- content -->
</div>
Basically I am looking for a similar functionality to CodeIgniter’s url segment methods.
Is the class simply the name of the module? If it is, do this:
You could also set it as a parameter on the request by defining it in your routes:
Then get it off the request in your template:
Finally, if it’s the same for each module but not equivalent to the module name, you could set it in
preExecute: