In a Play Framework 2.0 app, I would like to be able to specify a CSS class for the active page. How do I that?
<li @if( ) { class="active" }>
<a href="@routes.Application.index()"> Home </a>
</li>
Specifically, what do I put in the if statement?
@request.uri works at least with play framework 2 to see more read http://www.playframework.org/documentation/api/2.0/java/play/mvc/Http.Request.html
Edit: You can try this for example..
@if(request.uri.contains("home")){
..home word in url..
} else {
..home word not in url..
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With